Problem with bot and puppeteer

rm /etc/apt/sources.list.d/focal-security.list
apt update

Ok, I’ve already fixed that. Now it’s like starting the thread again with the problem I had at the beginning :sweat_smile:

Error: Cannot find module './utils/exit-handler.js'
Require stack:
- /usr/local/lib/node_modules/npm/lib/cli.js
- /usr/local/lib/node_modules/npm/bin/npm-cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:81:23)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:2:25)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/npm/lib/cli.js',
    '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
  ]

this time it is a different error message / module

First time it was

now it seems to be

can you check following

ls -la /usr/local/lib/node_modules/npm/lib/utils
root@DietPi:~# ls -la /usr/local/lib/node_modules/npm/lib/utils
total 180
drwxr-xr-x 4 root root  4096 mar 22 17:37 .
drwxr-xr-x 5 root root  4096 mar 21 18:32 ..
-rw-r--r-- 1 root root   173 oct 26  1985 ansi-trim.js
-rw-r--r-- 1 root root  1040 oct 26  1985 audit-error.js
-rw-r--r-- 1 root root  2871 oct 26  1985 auth.js
-rw-r--r-- 1 root root  2506 oct 26  1985 cmd-list.js
drwxr-xr-x 2 root root  4096 mar 21 18:32 completion
-rw-r--r-- 1 root root  1596 oct 26  1985 completion.fish
-rwxr-xr-x 1 root root  1898 oct 26  1985 completion.sh
drwxr-xr-x 2 root root  4096 mar 21 18:32 config
-rw-r--r-- 1 root root  1498 oct 26  1985 did-you-mean.js
-rw-r--r-- 1 root root  3464 oct 26  1985 display.js
-rw-r--r-- 1 root root 13397 oct 26  1985 error-message.js
-rw-r--r-- 1 root root  3838 oct 26  1985 explain-dep.js
-rw-r--r-- 1 root root  2596 oct 26  1985 explain-eresolve.js
-rw-r--r-- 1 root root   629 oct 26  1985 format-bytes.js
-rw-r--r-- 1 root root  4023 oct 26  1985 format-search-stream.js
-rw-r--r-- 1 root root   802 oct 26  1985 get-identity.js
-rw-r--r-- 1 root root   233 oct 26  1985 is-windows.js
-rw-r--r-- 1 root root  7111 oct 26  1985 log-file.js
-rw-r--r-- 1 root root  1718 oct 26  1985 log-shim.js
-rw-r--r-- 1 root root  2090 oct 26  1985 npm-usage.js
-rw-r--r-- 1 root root  1114 oct 26  1985 open-url.js
-rw-r--r-- 1 root root  1472 oct 26  1985 open-url-prompt.js
-rw-r--r-- 1 root root  1259 oct 26  1985 otplease.js
-rw-r--r-- 1 root root   252 oct 26  1985 ping.js
-rw-r--r-- 1 root root   412 oct 26  1985 pulse-till-done.js
-rw-r--r-- 1 root root  9787 oct 26  1985 queryable.js
-rw-r--r-- 1 root root  2044 oct 26  1985 read-user-info.js
-rw-r--r-- 1 root root   876 oct 26  1985 reify-finish.js
-rw-r--r-- 1 root root  5087 oct 26  1985 reify-output.js
-rw-r--r-- 1 root root   807 oct 26  1985 replace-info.js
-rw-r--r-- 1 root root  3993 oct 26  1985 tar.js
-rw-r--r-- 1 root root  2797 oct 26  1985 timers.js
-rw-r--r-- 1 root root  4548 oct 26  1985 update-notifier.js
-rw-r--r-- 1 root root  1023 oct 26  1985 validate-lockfile.js
-rw-r--r-- 1 root root   558 oct 26  1985 web-auth.js

not sure how this is possible, but you are missing exit-handler.js module. I just did a try and for me it was available.

root@DietPi4:~# ls -la /usr/local/lib/node_modules/npm/lib/utils/exit-handler.js
-rw-r--r-- 1 1001 1001 7001 Jan 17 07:00 /usr/local/lib/node_modules/npm/lib/utils/exit-handler.js
root@DietPi4:~#

Even more strange as the module is part of the archive we download.

Can you try to reinstall and check again

dietpi-software reinstall 9
ls -la /usr/local/lib/node_modules/npm/lib/utils/exit-handler.js

Ok, that problem is already solved xD. I’m very sorry for being so heavy, but now I have another when it comes to executing the bot that my friend created for me

root@DietPi:/mnt/USB/VineMonitoringBot# npm install node-telegram-bot-api

up to date, audited 182 packages in 3s

7 packages are looking for funding
  run `npm fund` for details

2 moderate severity vulnerabilities

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
root@DietPi:/mnt/USB/VineMonitoringBot# sudo npm audit
# npm audit report

request  *
Severity: moderate
Server-Side Request Forgery in Request - https://github.com/advisories/GHSA-p8p7-x288-28g6
No fix available
node_modules/request
  node-telegram-bot-api  *
  Depends on vulnerable versions of request
  node_modules/node-telegram-bot-api

2 moderate severity vulnerabilities

Some issues need review, and may require choosing
a different dependency.

What exactly is your issue? The script of your friend seems to pull some additional packages. We don’t maintain them as they are out of our control. Better to check with the developer directly who created this script.

I already solved that problem, but now I have another related one and I don’t know if you know what it could be…

/mnt/USB/vine-es-love/node_modules/@puppeteer/browsers/lib/cjs/launch.js:262
                reject(new Error([
                       ^

Error: Failed to launch the browser process! spawn chromium-browser ENOENT


TROUBLESHOOTING: https://pptr.dev/troubleshooting

    at ChildProcess.onClose (/mnt/USB/vine-es-love/node_modules/@puppeteer/browsers/lib/cjs/launch.js:262:24)
    at ChildProcess.emit (node:events:512:28)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v19.8.1

you are trying to launch chromium-browser. Has it been installed already?

Yes, it is installed. Two days ago it worked for me, it was due to a Chromium update yesterday

you could try to reboot if not already done. In general apt package updates are out of our control.

Yes, I already did and it’s still the same

did you tried to contact the one who created this script? Probably better to check with the original developer on what the issue could be.