node-red-contrib-rfxcom install issue

I’ve just released a new version of norelite that includes some fixes to the code and I ran into some issues when doing “npm update” of my installed Node-RED modules and it might be of interest to others to know how I fixed it.

The issue was not related to norelite but to node-red-contrib-rfxcom that simply couldn’t compile serialport@2.1.2 which is a dependency. After a lot of attempts and actually a re-install of nodejs, Node-RED and npm I finally found an instruction in the Node-RED docs related to Wheezy (I’m running Jessie though) that fixed the problem.

This was the error message that I received:

Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/pi/.node-red/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/pi/.node-red/node_modules/serialport/build/Release' (1)
npm ERR! Linux 4.1.13-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install" "serialport@2.1.2"
npm ERR! node v4.4.7
npm ERR! npm  v2.14.15
npm ERR! serialport@2.1.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@2.1.2 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/.node-red/npm-debug.log

And I solved it as follows: I first installed serialport@2.1.2 with unsafe-perm variable set and then node-red-contrib-rfxcom as follows (you could probably just use the variable with node-red-contrib-rfxcom)

cd ~/.node-red
sudo npm install --unsafe-perm serialport@2.1.2
sudo npm install node-red-contrib-rfxcom