Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8013

Other programming languages • Trying to install NodeJS and serialport.

$
0
0
I have a running project where nodejs has become messy. ‘node server.js’ works but ‘sudo node server.js’ does nothing. The reboot uses root or sudo and doesn’t work, so the app doesn’t auto-start.

I thought I’d start again on a new CF card, and I need a spare anyway. So I installed node, and ran the application, knowing it would complain of missing modules. The first is serialport. (Next it will need socketio, udp.)

So: sudo npm install serialport - alright so far
Run the app – complains of a syntax error inside one of the serialport modules. Doesn’t say what the call from the app is. Do I want to debug my working application? No, see what version of serialport I was using and install that.

sudo uninstall serialport
sudo install serialport@8.0.8 (it took 15 minutes)
run the app – it says no module serialport
Try installing global
sudo uninstall serialport
sudo install –g serialport@8.0.8
app still says there’s no module. What does npm say?
npm list | grep serialport - it says serialport@13.0.0 is installed.

I started using nodjs a few years ago, and it was quick, easy and fun. Everything worked. Now nothing works first time, I spend ages installing/uninstalling not knowing if I’m getting anywhere. Please tell me something to make it all better.

Statistics: Posted by RichardDL — Sat Aug 02, 2025 4:29 pm



Viewing all articles
Browse latest Browse all 8013

Trending Articles