Snothy / trovobot

A simple library for creating Trovo chat bots
4 stars 2 forks source link

Connect fails on Alpine Linux #1

Closed thirdwheel closed 1 year ago

thirdwheel commented 1 year ago

When attempting to connect to Trovo in Alpine Linux, I get the below error:

Launching...
(node:3743) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! spawn /home/amason/twitchbot/node_modules/puppeteer/.local-
chromium/linux-901912/chrome-linux/chrome ENOENT

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

    at onClose (/home/amason/twitchbot/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:203:20)
    at ChildProcess.<anonymous> (/home/amason/twitchbot/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:195:85)
    at ChildProcess.emit (events.js:400:28)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3743) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function withou
t 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:3743) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will ter
minate the Node.js process with a non-zero exit code.

When I try to run the bundled chrome executable, I get:

dev:~/twitchbot$ node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome
/bin/ash: node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: not found

It definitely exists and is an executable:

dev:~/twitchbot$ file node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome
node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[xxHash]=e64ea5b822d5d5d0, not stripped

There is a fix for this as spelled out in a comment on puppeteer issue 1793 and I will initiate a pull request that includes this fix shortly.

thirdwheel commented 1 year ago

Found the solution. Supply the path to your chrom{e,ium} in the PUPPETEER_EXECUTABLE_PATH environment variable like so:

PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser node bot.js