NPM的安装节点red-contrib-i2c失败



我的节点红色安装和安装其他节点软件包一直存在问题...我正在尝试在Raspberry Pi HTTP上安装Node-red-contrib-i2c软件包://flows.nodered.org/node/node-red-contrib-i2c ...这是我的控制台输出:

pi@raspberrypi:~ $ npm install node-red-contrib-i2c

更多控制台输出...然后错误:

make: Leaving directory '/home/pi/node_modules/node-red-contrib-i2c/node_modules/i2c/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.4.50-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pi/node_modules/node-red-contrib-i2c/node_modules/i2c
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! i2c@0.2.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the i2c@0.2.3 install script.
npm ERR! This is most likely a problem with the i2c package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls i2c
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.4.50-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-red-contrib-i2c"
npm ERR! cwd /home/pi
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/npm-debug.log
npm ERR! not ok code 0

我也尝试安装的其他几个软件包也发生了类似的事情,包括MCP3008 ADC节点软件包。

删除您的$HOME/.node-gyp。它应该解决您的问题

好的,所以我最终解决了问题。发生的事情是,由PI预先安装的Nodejs版本是一个较旧的版本,需要升级以安装该节点红色的特定节点,因此我使用了:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs

这将Nodejs版本从0.10.29升级为6版。在撰写本文时,0.10.29在标准的Raspberry Pi Jessie安装中。然后安装节点-RED I2C工作正常。

最新更新