INA219 install woes

I have a fresh install of Buster + node red (RPI 3b+) and am building up my system again from scratch.
All my modules install fine except for ...npm install ina219
It fails every time with error messages too numerous to add here.
Any one else encountered this.

Have you installed build-essential?
On Ubuntu (which is usually near enough Buster) there are loads of warnings but it does install eventually. Look for something like

+ ina219@0.6.2
added 4 packages from 10 contributors in 8.921s

right at the end.

Nope! the last few lines are:

make: *** [ Release/] Error 1
make: Leaving directory '/home/pi/.node-red/node_modules/ina219/node_modules/i2c-bus/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:223:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.93-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/ina219/node_modules/i2c-bus
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

npm ERR! errno 1
npm ERR! i2c-bus@1.2.5 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the i2c-bus@1.2.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-02-04T16_09_22_390Z-debug.log
pi@atticPI:~/.node-red $

It seems the node will not install with nodejs 12. You could downgrade to nodejs 10 and hope the node is updated before you find a reason that you must use 12.

Did you try node-red-contrib-easybotics-ina219-sensor ?

node-red-contrib-easybotics-ina219-sensor would not install either.
How do I downgrade to nodejs 10?

First stop node-red and uninstall nodejs using
sudo apt remove nodejs
Then install version 10 using the instructions in this post, replacing the 6 in the command with 10, Then you have to re-install node-red (in order to rebuild bits of it for nodejs 10) using
sudo npm install -g node-red --unsafe-perm
Finally you have to rebuild all your locally installed nodes using

cd .node-red
npm rebuild

Then you should be able to restart node-red

Thanks so much.. I'll try that.

That all worked for me.. fantastic. It's a pleasure to come on to a forum where folks are so helpful and tolerant of those not so experienced. (unlike some other forums)
thanks again.

Should you want to upgrade node red when a new release comes out you can still use the script to upgrade it. Since you have an acceptable version of nodejs already installed it will not upgrade it to 12.

Sorry.. a little confused. You say I can upgrade, but then you say it will not upgrade.

the script will update node-red but leave node.js alone if it is a node.js v 10.X

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.