codeterrayt / WhatsAppCabBookingBot

WhatsApp Cab Booking Bot is a Node.js project for easy cab reservations via WhatsApp. It features user-friendly booking for passengers and convenient command-based management for owners. Enhance the cab booking experience with this streamlined solution in the familiar WhatsApp interface.
MIT License
8 stars 0 forks source link

Requires Puppeteer/Chromium? #2

Open X3Zero opened 4 months ago

X3Zero commented 4 months ago

I've been trying to get this work and I've encountered this requires not only Node.js/npm as indicated but also Puppeteer and Chromium to work.

I'm using a shared hosting to deploy it, Database is connected, Node/Npm works, however I keep running into this:

(node:121) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. 
Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Database Connected!
/home/user/WhatsAppCabBookingBot/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241
            reject(new Error([
                   ^
Error: Failed to launch the browser process!
[128:128:0728/081319.031726:ERROR:resource_bundle.cc(987)] 
Failed to load /home/user/WhatsAppCabBookingBot/node_modules/whatsapp-web.js/node_modules/puppeteer/.local-chromium/linux-982053/chrome-linux/resources.pak
Some features may not be available.
[warn] epoll_create: Too many open files

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/home/user/WhatsAppCabBookingBot/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20)
    at ChildProcess.<anonymous> (/home/user/WhatsAppCabBookingBot/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:232:79)
    at ChildProcess.emit (node:events:532:35)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12)

I would appreciate any kind of help fixing these puppeteer errors. Thank you.

codeterrayt commented 3 months ago

try with node 20 or 21

NODE_OPTIONS='--trace-deprecation'
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
sudo apt-get install chromium-browser
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

In case of chromium issue :

node node_modules/puppeteer/install.js

Please try to uninstall whatsapp-web.js dependency from package.json and reinstall it again.