Build NodeJS from Source
Since your Smart Mobile Studio programs can run from Linux under Raspberry PI, I figured I could write a few words about building from C/C++ source. Normally you don’t need to do this, but in case the process-manager (which makes sure your Smart NodeJS servers can be clustered and essentially controlled as services) can be picky about the version – you may suddenly find yourself needing the cutting edge.
Open up a command-line prompt and CD (change dir) to the location you want to keep node. Since this is so essential to my system I keep it at root (/), but you may want to stuff it in your home folder.
Either way, cd to the location then do:
sudo apt-get install build-essential sudo apt-get install curl openssl libssl-dev
Odds are this is up to date (it was on my fresh Raspbian image). If not, let it finish (you may need to press “y” at some point) and let it work itself out.
You also need to install git (may also already be there):
sudo apt-get install git
With those in place, let’s do a clone of the node.js repository:
git clone https://github.com/nodejs/node.git
When its finished you should have a “nodejs” folder available. So we cd into that and do a configure:
cd node ./configure make sudo make install
Now building anything on the Raspberry PI is slow. So the “make” call will probably take 1.5 hours depending on your PI. If its overclocked you will probably get away with 45 minutes, but a bog standard Raspberry PI 3 is much slower.
When it’s all done, test it with
As of writing that prints out “8.0.0-pre” since im using the cutting edge pre-release version right now.
Now you can install npm (node package manager) and them pm2 and enjoy the show 🙂