Problem with bot and puppeteer

I have a friend who has created a bot for some Amazon ads through Telegram and I have followed all his instructions, but when I run the bot it tells me this and it can’t be fixed. Any ideas? thank you

root@DietPi:/mnt/USB/VineMonitoringBot# node vineScrapper.js
internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module 'fs/promises'
Require stack:
- /mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js
- /mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/node.js
- /mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/puppeteer-core.js
- /mnt/USB/VineMonitoringBot/vineScrapper.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 Object.<anonymous> (/mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js:59:20)
    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)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/node.js:32:14)
    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)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/puppeteer-core.js:35:14)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js',
    '/mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/node.js',
    '/mnt/USB/VineMonitoringBot/node_modules/puppeteer-core/lib/cjs/puppeteer/puppeteer-core.js',
    '/mnt/USB/VineMonitoringBot/vineScrapper.js'

looks like something is missing to run your app. Maybe a Node (npm) software dependency

How do I know what I’m missing? I’m quite a noob on this topic hehe

simply use your preferred search engine provider and use Cannot find module 'fs/promises' as key words.

Sorry, but as I said I’m pretty new to these issues and I don’t know exactly what you want to tell me. Another thing, npm is now giving me another error and I don’t know why…

ERROR: npm v9.6.2 is known not to run on Node.js v12.22.12. You'll need to
upgrade to a newer Node.js version in order to use this version of npm. This
version of npm supports the following node versions: `^14.17.0 || ^16.13.0 ||
>=18.0.0`. You can find the latest version at https://nodejs.org/.

ERROR:
/usr/local/lib/node_modules/npm/lib/utils/exit-handler.js:21
  const hasLoadedNpm = npm?.config.loaded
                           ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    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)
    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)

You would need to upgrade nodejs.

Unfortunately you ignored our troubleshooting template. Therefore we don’t known what system you are running. Maybe you could share these information.

I did that but still the same

This use DietPi v8.15.2

root@DietPi:~# npm -v
/usr/local/lib/node_modules/npm/lib/cli.js:48
    throw err
    ^

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'
  ]
}

Required

  • DietPi version | cat /boot/dietpi/.version
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
  • Kernel version | uname -a
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)

How did you installed Node.js?

G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=15
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
bullseye 0
Linux DietPi 6.1.19-v8+ #1637 SMP PREEMPT Tue Mar 14 11:11:47 GMT 2023 aarch64 GNU/Linux
RPi 4 Model B (aarch64)

sudo apt-get install nodejs

But that error is given to me with npm

I recommend to purge the package again and install Node.js from dietpi-software catalouge. This should install following

root@DietPi4:~# npm -v
9.5.1
root@DietPi4:~# node -v
v19.8.1
root@DietPi4:~#

I get an error when installing node from dietpi-software

 APT update
│  - Command: apt-get -y -eany update
│  - Exit code: 100
│  - DietPi version: v8.15.2 (MichaIng/master) | HW_MODEL: 4 | HW_ARCH: 3 |
│ DISTRO: 6
│  - Image creator: DietPi Core Team
│  - Pre-image: from scratch
│  - Error log:
│ Hit:1 https://deb.debian.org/debian bullseye InRelease
│ Hit:2 https://deb.debian.org/debian bullseye-updates InRelease
│ Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
│ Hit:4 https://deb.debian.org/debian-security bullseye-security InRelease
│ Hit:5 https://deb.debian.org/debian bullseye-backports InRelease
│ Hit:6 https://archive.raspberrypi.org/debian bullseye InRelease
│ Err:3 http://security.ubuntu.com/ubuntu focal-security InRelease
│   The following signatures couldn't be verified because the public key is
│ not available: NO_PUBKEY 3B4FE6ACC0B21F32 NO_PUBKEY 871920D1991BC93C
│ Reading package lists...
│ W: GPG error: http://security.ubuntu.com/ubuntu focal-security InRelease:
│ The following signatures couldn't be verified because the public key is not
│ available: NO_PUBKEY 3B4FE6ACC0B21F32 NO_PUBKEY 871920D1991BC93C
│ E: The repository 'http://security.ubuntu.com/ubuntu focal-security
│ InRelease' is not signed.

Not directly from the installation, it comes from apt-get -y -eany update and you have some ubuntu sources in your sources list, which make trouble. Did you add them by yourself?

Well, I don’t know, because I’ve tried many things to fix the problem.

How do I solve this problem too?

you defintely should remove the Ubuntu repository. DietPi is based ob Debian and adding an Ubuntu repository could cause quite some issues.

How do I do that? I’m pretty new

How did you add the Ubuntu repository? :wink:

Ok let’s check where it is configured.

for i in /etc/apt/sources.list{,.d/*.list}; do echo "$i:"; cat "$i"; done
/etc/apt/sources.list:
deb https://deb.debian.org/debian/ bullseye main contrib non-free
deb https://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb https://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb https://deb.debian.org/debian/ bullseye-backports main contrib non-free
/etc/apt/sources.list.d/focal-security.list:
deb http://security.ubuntu.com/ubuntu focal-security main
/etc/apt/sources.list.d/raspi.list:
deb https://archive.raspberrypi.org/debian/ bullseye main