I’ve been banging my head against the wall trying to get LaserWeb setup on an RPi 3, and I failed at the first hurdle - installing Node!
If you follow the instructions for installing to Raspberry Pi, on Raspbian Stretch, npm doesn’t get installed - and if you then try to install it through apt, the version that gets installed is 1.something - far too low for LaserWeb to use.
I’ve found a workaround - this replaces the first section in the guide (" Install Node 6.x"):
This will initially install the latest version of Node, but we can install our preferred version by then running:
sudo node-install -v 6.17.1
This will install the versions that we need, including npm. This is what versions get installed:
node -v
v6.17.1
npm -v
3.10.10
The only other issue I found was with the config.js file - I needed to change the first line, changing .load into .config instead (this is an issue with the new dotenv library, not directly related to the node version)
So now I have a happily running Raspberry Pi running lw-comm-server fine, and hopefully this will help others trying to do the same.
Just wanted to give an alternative solution as I was struggling the same on my Raspberry Pi today.
I am using a Raspberry Pi 2 and followed the instructions on the Github Wiki. However I installed the latest version of Node (12.4) which went perfectly fine. The only thing that didn’t work was - as noted by others - the compilation of the SerialPort library. To make that work, I changed the version of the SerialPort library to 7.1.5 (latest) in the package.json file and then rerun npm install. After that, all worked perfectly well!
The problem is that a release of a third party library like SerialPort is made for a specific Node version (or a minimum). As soon as this version dependency isn’t there any longer, issues will appear.
To overcome this, software projects must define which version of third party libraries they use/support and have this locked down. For Node this can be done by providing the npm .lock file with the source code. Node will then use the provided lock file rather than pulling the latest versions of each dependency.
The versions of all dependencies are already defined in the package.json file (versions can be fixed to a specific major version). It’s just not managed perfectly
PS: I recomend to stay with the LTS version 10 of node js.
You are correct, however the combination of Node 10 and SerialPort 6.2.2 is not defined. There is an option you can set in the package.json to specify the required Node version: “engines”. For example { "engines" : { "node" : ">=0.12" } }
Just wanted to let others know they can use Node 12 but need to use SerialPort version 7.1.5