Closed akshaymemail closed 2 years ago
I'm running into the same issue. Apparently /app/node_modules/whatsapp-web.js/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
libnss3 is missing. Any solutions on this?
use const client = new Client({ puppeteer: { headless: true,args: ['--no-sandbox', '--disable-setuid-sandbox']}, session: sessionCfg });
use const client = new Client({ puppeteer: { headless: true,args: ['--no-sandbox', '--disable-setuid-sandbox']}, session: sessionCfg });
doesn't work for me. I'm using the lib on EC2 linux. Version: 1.15.3
any solution for this problem?
Clean the modules and reinstall. It works.
I was running into the same problem and after some debugging it ended up being the version of browserless. Always get the stable version instead of the last one:
version: '3.5'
services:
browserless:
image: browserless/chrome:1.50-chrome-stable
environment:
- PREBOOT_CHROME=true
- KEEP_ALIVE=true
- CHROME_REFRESH_TIME=86400000
- MAX_CONCURRENT_SESSIONS=1
- MAX_QUEUE_LENGTH=20
- CONNECTION_TIMEOUT=600000
- ENABLE_CORS=true
ports:
- '3000:3000'
restart: unless-stopped
For the debugging process i used:
client.initialize().catch(console.log);
ErrorEvent {
target: WebSocket {
_events: [Object: null prototype] { open: [Function], error: [Function] },
_eventsCount: 2,
_maxListeners: undefined,
_binaryType: 'nodebuffer',
_closeCode: 1006,
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: '',
_closeTimer: null,
_extensions: {},
_protocol: '',
_readyState: 3,
_receiver: null,
_sender: null,
_socket: null,
_bufferedAmount: 0,
_isServer: false,
_redirects: 0,
_url: 'ws://c2:3000',
_req: null,
[Symbol(kCapture)]: false
},
type: 'error',
message: 'socket hang up',
error: Error: socket hang up
at connResetException (node:internal/errors:691:14)
at Socket.socketOnEnd (node:_http_client:471:23)
at Socket.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET'
}
}
Same error here. I found that if I add this buildpack to Heroku repo, it works but the slug size increase over 350mb:
heroku buildpacks:add https://github.com/jontewks/puppeteer-heroku-buildpack.git
Same error here. I found that if I add this buildpack to Heroku repo, it works but the slug size increase over 350mb:
heroku buildpacks:add https://github.com/jontewks/puppeteer-heroku-buildpack.git
And this is the only way I can deploy to Heroku and run the client at this moment:
const client = new Client({
session: sessionData,
puppeteer: {
headless: true,
args: ['--no-sandbox']
}
});
Closing as unrelated to whatsapp-web.js. This is likely due to something with your environment not being able to run puppeteer.
No one? help us, pls!
Install Cromium-browser.
sudo apt-get install chromium-browser
Install other dependencies required for ubuntu
sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 li-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 li libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev
NOTE : As whatsapp-web.js is constantly upgrading, by the time you replicate this steps you may need to install some more dependencies apart from mentioned in Step 2. Just copy that dependency and stackoverflow it you will surely get its solution.
No one? help us, pls!
I would recommend the same as @N-D-P has said right above and I encourage you to search on StackOverflow as well. Your problem is very common among Linux Servers.
As a complementary for Step 2 Mentioned above, I would recommend you install those ones as well. The first thing of course: Do it: sudo apt-get update -y then -> sudo apt install -y libatk-bridge2.0-0 && sudo apt install -y libxkbcommon-x11-0 && sudo apt-get install -y libxdamage-dev
All of them included what @N-D-P said is: sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 li-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 li libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev libatk-bridge2.0-0 libxkbcommon-x11-0 libxdamage-dev
I am getting these errors while running whatsaap-web.js home/samplebot/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241 reject(new Error([ ^
Error: Failed to launch the browser process! [0409/224659.794826:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/samplebot/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20)
at Interface.<anonymous> (/home/samplebot/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:231:68)
at Interface.emit (node:events:538:35)
Anybody have any solution for this , Please helpme , Im completely stucked
@monishavp What version of whatsapp-web.js are you using?
Coz whatsapp-web.js is highly unstable, I would recommend remove whatsapp-web.js dependency from package.json and install it again
This has worked for me so many times
And if you are using linux, try installing below things first.
This solution worked for EC2 linux server
- Install Cromium-browser.
sudo apt-get install chromium-browser
- Install other dependencies required for ubuntu
sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 li-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 li libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev
NOTE : As whatsapp-web.js is constantly upgrading, by the time you replicate this steps you may need to install some more dependencies apart from mentioned in Step 2. Just copy that dependency and stackoverflow it you will surely get its solution.
Make sure you have chromium-browser
installed
Then use const client = new Client({ authStrategy: new LocalAuth(), puppeteer: { product: "chrome", executablePath: "/usr/bin/chromium-browser" } });
This worked on my raspberrypi (OS: Raspbian GNU/Linux 11 (bullseye)
)
Hi. As pointed out correctly by @N-D-P the issue is that the required dependencies are not installed for ubuntu. I followed his path and got it working. Below is the command that you can use. To install chromium
sudo apt-get install chromium-browser
Install the dependencies.
sudo apt-get install ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
Great !! Happy Coding ;) @uthx
@uthx
Oi. Como apontado corretamente por@N-D-Po problema é que as dependências necessárias não estão instaladas para o ubuntu. Segui seu caminho e consegui. Abaixo está o comando que você pode usar. Para instalar o cromo
sudo apt-get install chromium-browser
Instale como dependências.
sudo apt-get install ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
@uthx Hello my friend!! I run the commands from step 1 and 2. The problem persists when running node example.js, help me plz.
@uthx
Oi. Como apontado corretamente por@N-D-Po problema é que as dependências necessárias não estão instaladas para o ubuntu. Segui seu caminho e consegui. Abaixo está o comando que você pode usar. Para instalar o cromo
sudo apt-get install chromium-browser
Instale como dependências.
sudo apt-get install ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
@uthx Hello my friend!! I run the commands from step 1 and 2. The problem persists when running node example.js, help me plz.
Hey @pauloppaa, are you trying to install them in a linux server image?
@uthx
Oi. Como apontado corretamente por@N-D-Po problema é que as dependências necessárias não estão instaladas para o ubuntu. Segui seu caminho e consegui. Abaixo está o comando que você pode usar. Para instalar o cromo
sudo apt-get install chromium-browser
Instale como dependências.
sudo apt-get install ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
@uthx Hello my friend!! I run the commands from step 1 and 2. The problem persists when running node example.js, help me plz.
Hey @pauloppaa, are you trying to install them in a linux server image?
Hey @uthx Ubuntu Server 22.04 LTS (HVM) in AWS/ec2
@pauloppaa I tried it on Digital Ocean for ubuntu and it worked for me. I found this in the guide, check this out if it helps.
my own scenerio is that im pushing to Azure App service which uses a linux server for hosting, but i use macos, how do i install those dependencies to Azure linux server since apt-get is not available in macos. ive used brew to install them locally, there isnt any changes, i still experience the error
This solution worked for EC2 linux server
- Install Cromium-browser.
sudo apt-get install chromium-browser
- Install other dependencies required for ubuntu
sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 li-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 li libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev
NOTE : As whatsapp-web.js is constantly upgrading, by the time you replicate this steps you may need to install some more dependencies apart from mentioned in Step 2. Just copy that dependency and stackoverflow it you will surely get its solution.
Trying to run it in EC2 instance inside Docker Container and it works perfectly!
Clean the modules and reinstall. It works.
This worked for me too!! Thanks
Estou com esse problema.
/root/github/api_whatsapp/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:299 reject(new Error([ ^
Error: Failed to launch the browser process! /root/github/api_whatsapp/node_modules/whatsapp-web.js/node_modules/puppeteer-core/.local-chromium/linux-1045629/chrome-linux/chrome: error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/root/github/api_whatsapp/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:299:20)
at Interface.<anonymous> (/root/github/api_whatsapp/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:287:24)
at Interface.emit (node:events:529:35)
at Interface.close (node:internal/readline/interface:534:10)
at Socket.onend (node:internal/readline/interface:260:10)
at Socket.emit (node:events:529:35)
at endReadableNT (node:internal/streams/readable:1400:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v18.19.1 [nodemon] app crashed - waiting for file changes before starting...
Boa noite. Consegui resolver adaptando dessa forma.
const client = new Client({ authStrategy: new LocalAuth(), puppeteer: { product: "chrome", executablePath: "/usr/bin/chromium-browser", args: ['--no-sandbox', '--disable-setuid-sandbox', '--headless'] } });
Espero ter ajudando vcs! Estou usando uma VPS com UBUNTU.
puppeteer: { headless: true,args: ['--no-sandbox', '--disable-setuid-sandbox']
worked for me
error description
Getting this error when deploying to server, locally is running fine
(node:46580) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! /var/www/whatsapp-automation/node_modules/whatsapp-web.js/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
(Use
node --trace-warnings ...
to show where the warning was created) (node:46580) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:46580) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.Library
14.17.0
):Other