theoomoregbee / US-visa-appointment-notifier

This is just a script I put together to check and notify me via email (MailGun) when there's an earlier date before my initial appointment date. It doesn't handle rescheduling.
MIT License
104 stars 57 forks source link

npm start with an error #22

Closed SumitMistry closed 1 year ago

SumitMistry commented 1 year ago

npm start not working with below error:

root@ubuntu-22:~/USvisa/US-visa-appointment-notifier# npm start

> us-visa-appointment-notifier@1.0.0 start
> node index.js

(node:16687) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
[0312/043410.440449: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 (/root/USvisa/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:290:20)
    at Interface.<anonymous> (/root/USvisa/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:278:24)
    at Interface.emit (events.js:326:22)
    at Interface.close (readline.js:416:8)
    at Socket.onend (readline.js:194:10)
    at Socket.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

(node:16687) 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:16687) [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.
theoomoregbee commented 1 year ago

Are you still getting this error @SumitMistry?

SumitMistry commented 1 year ago

Are you still getting this error @SumitMistry?

No luck yet, it is more likely to chromium browser config and run related problem. I can reproduce again the same above error after re-installing old npm and node packages.

But I investigated and found that if I directly run the chromium browser, it's giving this similar error as the above So running the project by calling "npm start" or running this command "/usr/bin/chromium-browser "both same error.

`root@ubuntu-22:~/USvisa/US-visa-appointment-notifier# /usr/bin/chromium-browser

mkdir: cannot create directory /run/user/0': Permission denied

[15323:15323:0329/034029.507677:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.`

or

`root@ubuntu-22:~/USvisa/US-visa-appointment-notifier# npm start

us-visa-appointment-notifier@1.0.0 start node index.js

/root/USvisa/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:290 reject(new Error([ ^ Error: Failed to launch the browser process

[0329/034504.681214: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 (/root/USvisa/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:290:20) at Interface. (/root/USvisa/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:278:24) at Interface.emit (node:events:525:35) at Interface.close (node:readline:590:8) at Socket.onend (node:readline:280:10) at Socket.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1358:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) root@ubuntu-22:~/USvisa/US-visa-appointment-notifier# `

so in short, we should add some documentation on Chromium/ Puppeteer related dependency on how to solve this. Any suggestion?

SumitMistry commented 1 year ago

Solved, I guess the problem was the root user and VM and the directory which I was running was in Windows structure and not created in the Linux. so reinstalled ubuntu, and cloned the git repo into a linux HOME folder and then running from there with SUDO/root access solved this problem.