Unable install to node-red-contrib-grovepi

Hi there, while i was installing node-red-contrib-grovepi, the following errors occur,

2019-11-23T15:35:44.962Z [err] ERR! build error
2019-11-23T15:35:44.963Z [err]  
2019-11-23T15:35:44.966Z [err] gyp
2019-11-23T15:35:44.966Z [err]  ERR!
2019-11-23T15:35:44.966Z [err]  stack
2019-11-23T15:35:44.967Z [err]  Error: `make` failed with exit code: 2
2019-11-23T15:35:44.967Z [err] gyp 
2019-11-23T15:35:44.967Z [err] ERR! stack
2019-11-23T15:35:44.968Z [err]      at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
2019-11-23T15:35:44.968Z [err] gyp 
2019-11-23T15:35:44.969Z [err] ERR! 
2019-11-23T15:35:44.969Z [err] stack     at ChildProcess.emit (events.js:210:5)
2019-11-23T15:35:44.969Z [err] gyp
2019-11-23T15:35:44.969Z [err]  ERR!
2019-11-23T15:35:44.970Z [err]  stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
2019-11-23T15:35:44.971Z [err] gyp
2019-11-23T15:35:44.971Z [err]  ERR! 
2019-11-23T15:35:44.972Z [err] System Linux 4.19.42-v7+
2019-11-23T15:35:44.972Z [err] gyp
2019-11-23T15:35:44.972Z [err]  ERR!
2019-11-23T15:35:44.973Z [err]  command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2019-11-23T15:35:44.973Z [err] gyp 
2019-11-23T15:35:44.973Z [err] ERR! 
2019-11-23T15:35:44.974Z [err] cwd /home/pi/.node-red/node_modules/buffertools
2019-11-23T15:35:44.974Z [err] gyp 
2019-11-23T15:35:44.974Z [err] ERR! 
2019-11-23T15:35:44.975Z [err] node -v v12.13.1
2019-11-23T15:35:44.975Z [err] gyp ERR!
2019-11-23T15:35:44.975Z [err]  node-gyp -v
2019-11-23T15:35:44.976Z [err]  v5.0.5
2019-11-23T15:35:44.976Z [err] gyp
2019-11-23T15:35:44.976Z [err]  ERR! 
2019-11-23T15:35:44.977Z [err] not ok 
2019-11-23T15:35:45.819Z [err] npm ERR! code ELIFECYCLE
2019-11-23T15:35:45.819Z [err] npm ERR! errno 1
2019-11-23T15:35:45.819Z [err] npm ERR! buffertools@2.1.6 install: `node-gyp rebuild`
2019-11-23T15:35:45.819Z [err] npm ERR! Exit status 1
2019-11-23T15:35:45.819Z [err] npm ERR! 
2019-11-23T15:35:45.819Z [err] npm ERR! Failed at the buffertools@2.1.6 install script.
2019-11-23T15:35:45.819Z [err] npm ERR!
2019-11-23T15:35:45.820Z [err]  This is probably not a problem with npm. There is likely additional logging output above.
2019-11-23T15:35:45.879Z [err] 
2019-11-23T15:35:45.879Z [err] npm ERR! A complete log of this run can be found in:
2019-11-23T15:35:45.879Z [err] npm ERR!
2019-11-23T15:35:45.880Z [err]      /home/pi/.npm/_logs/2019-11-23T15_35_45_835Z-debug.log

Anyideas on why it this happening? I have reinstalled node-red based on the documentation in https://nodered.org/docs/getting-started/raspberrypi . But it is still not working :frowning: :frowning:

Are you installing via the command line or via the node-red palette?
If command line which directory are you running it from and what command are you runnning?

I remember I had one of those so I just installed the node on my Pi and it works with an LDR on A0

One thing I noticed is that your system is reporting that you have node 12.31.1 installed and you don't get that with the standard install (you get 10.17.0) and the node (or more likely by look of logs - one of its dependencies buffertools@2.1.6 - might not like that version

[edit] - found this on buffertools github

so that looks to be the problem

You either probably need to downgrade your node.js version (I've never done that myself) or start again with a fresh Raspbian image

1 Like

Hi Colin,
I tried to install it through both Command Line and node-red palette, but the outcome is still the same. In command line, i installed it in the ~/.node-red directory using the command npm install node-red-contrib-grovepi .

Hi Cymplecy,

Thank you so much for pointing that out, I will try your solutions and tell you the outcome !

Hi Cymplecy,

I had downgraded node.js version to 10.17.0 using the commands found in this link https://www.surrealcms.com/blog/how-to-upgrade-or-downgrade-nodejs-using-npm.html and it works, thank you so much!!

1 Like

2 wins then - your fixed and you've found a easy downgrade method for others to use :slight_smile:

1 Like

Yes! :smile: The downgrade method is much easier than I thought, anyway one thing to take note is that you need to start a new terminal to change the node.js to a specific version after you downloaded it.

Is that every time you run Node-RED or just once?

Add an issue to the node's git page saying that it does not work with node 12.x so that others will see that there is a problem.
Also note that downgrading to node 10.x is not a long term solution as at some point node 10.x will become obsolete.

Just once will do :smile: , it will only happen when you want to change to a version that you haven’t downloaded, the system will download that specific version first, and then you have to start a new terminal to enter the command again to take effect.

You are right!