Error: libuuid.so.1: cannot open shared object file: No such file or directory

Getting this error with puppeteer on Railway.
node:internal/modules/cjs/loader:1239

return process.dlopen(module, path.toNamespacedPath(filename));

^

Error: libuuid.so.1: cannot open shared object file: No such file or directory

at Object.Module._extensions..node (node:internal/modules/cjs/loader:1239:18)

at Module.load (node:internal/modules/cjs/loader:1033:32)

at Function.Module._load (node:internal/modules/cjs/loader:868:12)

at Module.require (node:internal/modules/cjs/loader:1057:19)

at require (node:internal/modules/cjs/helpers:103:18)

at Object.<anonymous> (/app/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas/lib/bindings.js:3:18)

at Module._compile (node:internal/modules/cjs/loader:1155:14)

at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)

at Module.load (node:internal/modules/cjs/loader:1033:32)

at Function.Module._load (node:internal/modules/cjs/loader:868:12) {

code: 'ERR_DLOPEN_FAILED'

}
node:internal/modules/cjs/loader:1239

return process.dlopen(module, path.toNamespacedPath(filename));

^

Error: libuuid.so.1: cannot open shared object file: No such file or directory

at Object.Module._extensions..node (node:internal/modules/cjs/loader:1239:18)

at Module.load (node:internal/modules/cjs/loader:1033:32)

at Function.Module._load (node:internal/modules/cjs/loader:868:12)

at Module.require (node:internal/modules/cjs/loader:1057:19)

at require (node:internal/modules/cjs/helpers:103:18)

at Object.<anonymous> (/app/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas/lib/bindings.js:3:18)

at Module._compile (node:internal/modules/cjs/loader:1155:14)

at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)

at Module.load (node:internal/modules/cjs/loader:1033:32)

at Function.Module._load (node:internal/modules/cjs/loader:868:12) {

code: 'ERR_DLOPEN_FAILED'

}
railway.toml
[phases.setup]
aptPkgs = ['...', 'libuuid1']
nixPkgs = ['...', 'libuuid1']
nixLibs = ["...", "libuuid", "libGL"]

[build]
nixpacksVersion = "1.15.0"
[phases.setup]
aptPkgs = ['...', 'libuuid1']
nixPkgs = ['...', 'libuuid1']
nixLibs = ["...", "libuuid", "libGL"]

[build]
nixpacksVersion = "1.15.0"
Project ID: 045e21af-ff58-4d2c-a95a-4147dea211c9 Service ID: c040e311-95df-41bf-82ff-e87da0aa84fe Currently blocked on a release bc I can't get puppeteer to work
Solution:
my current recommendation would be to not try installing chrome into the container, but instead use browserless https://railway.app/template/browserless here is a working example of what that looks like in practice https://github.com/brody192/puppeteer-example this would also require you to switch to "puppeteer-core" instead of "puppeteer" so chrome isnt being installed, and your nixpacks.toml can be replaced with the nixpacks.toml thats in that repo....
Jump to solution
8 Replies
Percy
Percy3mo ago
Project ID: 045e21af-ff58-4d2c-a95a-4147dea211c9,c040e311-95df-41bf-82ff-e87da0aa84fe
Solution
Brody
Brody3mo ago
my current recommendation would be to not try installing chrome into the container, but instead use browserless https://railway.app/template/browserless here is a working example of what that looks like in practice https://github.com/brody192/puppeteer-example this would also require you to switch to "puppeteer-core" instead of "puppeteer" so chrome isnt being installed, and your nixpacks.toml can be replaced with the nixpacks.toml thats in that repo. doing it this way - - removes any head aches that come with installing chrome in docker. - improves build time significantly since chrome isnt being downloaded and installed on every deploy. - improves deploy time since chrome isnt bundled into the image anymore because a smaller image will deploy faster.
WilsonSquared
WilsonSquared3mo ago
I originally used browserless, but it's currently failing for scraping chrome web store URLs (it just hangs) https://chromewebstore.google.com/detail/senja-testimonial-extensi/lmldakdjelendidnmaieidggbffljlle
Senja - Testimonial Extension
Your testimonials everywhere on the web
Brody
Brody3mo ago
the template I linked is an updated version of the template, give it a try is that something you are trying to scrape or is that your app?
WilsonSquared
WilsonSquared3mo ago
Yeah we're using the latest version of everything. On second thought, browserless just doesn't work at all when using page.goto. This snippet just hangs:
Hey! For some reason this code snippet no longer works:

browser = await puppeteer.connect({
browserWSEndpoint: process.env.BROWSER_ENDPOINT,
});

console.log("Connected to browser. Opening new page");
const page = await browser.newPage();
console.log("Page opened. Navigating to the chrome web store");
await page.goto("https://senja.io");
Hey! For some reason this code snippet no longer works:

browser = await puppeteer.connect({
browserWSEndpoint: process.env.BROWSER_ENDPOINT,
});

console.log("Connected to browser. Opening new page");
const page = await browser.newPage();
console.log("Page opened. Navigating to the chrome web store");
await page.goto("https://senja.io");
It just hangs at page.goto. Works fine using local puppeteer. Any ideas why? Ah fixed it, was an invalid flag Will try using browserless for this
Brody
Brody3mo ago
have you deployed the linked template? it was very recently updated, recently meaning minutes before I sent my initial message in this thread
WilsonSquared
WilsonSquared3mo ago
Ah gotcha. I'm deploying it right now
Brody
Brody3mo ago
and please do checkout my readme in the linked github