I have the same error as in this thread. The solution is to set --shm-size=1gb.
From the Puppeteer docs, I found the following notes:
By default, Docker runs a container with a `/dev/shm` shared memory space 64MB.
This is [typically too small](https://github.com/c0b/chrome-in-docker/issues/1) for Chrome
and will cause Chrome to crash when rendering large pages. To fix, run the container
with `docker run --shm-size=1gb` to increase the size of `/dev/shm`. Since Chrome 65,
this is no longer necessary. Instead, launch the browser with the `--disable-dev-shm-usage`
flag
I've tried the following code but with no success:
const args = [`--app=${url}`, `--window-size=${WIDTH},${HEIGHT}`, '--disable-dev-shm-usage'];
const browser = await puppeteer.launch({
headless,
args
});
How to propperly set --shm-size for the Puppeteer?
Node version: 8.9.3
Platform: Windows 10
The Puppeteer function puppeteer.launch() allows for an optional options object.
Objects have names (or keys) and associated values.
Therefore, in order to pass Chromium flags to puppeteer.launch(), you must use the args key with an array value that contains the relevant flags:
const browser = await puppeteer.launch({
args: [
'--disable-dev-shm-usage',
],
});
In your example, you are passing the array without the args key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With