First problem: Node version
The version of Node installed from Raspbian repo is very old, and wouldn’t work with one of the required NPM modules.
Second attempt was to install Node using the official script from node.js, but this resulted in segmentation faults whenever you try to do anything. I assume it must have installed a version that wasn’t compiled for the ARM environment of the Raspberry Pi.
Third attempt: use a pre-built package mentioned on http://weworkweplay.com/play/raspberry-pi-nodejs/
I have no idea if it is a safe source, but I took a chance:
sudo dpkg -i node_latest_armhf.deb
Second problem: installing modules with NPM
I needed to install these two modules:
NPM was failing to get these, with something like:
pi@pi:~$ npm install thingspeakclient
npm http GET https://registry.npmjs.org/thingspeakclient
npm ERR! Error: failed to fetch from registry: thingspeakclient
The URL was clearly working in a browser. It turned out that the certificate was being rejected. This is fixed by issuing this command:
npm config set strict-ssl false