I am encountering an error when I go to start one of my Discord bots on my Raspberry Pi 3B.
/home/pi/Downloads/xx/xx/bot.js:301
if (channel?.messages.cache.has(packet.d.message_id)) return;
^
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 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
When running the same bot on my main Windows 11 Machine, it runs perfectly fine.
NodeJS/NPM on both my main machine and my R-Pi are running v16.15.1. Is there any way I could fix this? Thank you in advance.
As mentioned on the nodejs.org website, you can install the latest versions with the NodeSource deb package:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
# and then
sudo apt-get install -y nodejs
The default packages on your system are not up-to-date. Good day