红联Linux门户
Linux帮助

node -e "require('nan')" npm安装tty.js时报错,解决方法

发布时间:2016-07-02 15:31:09来源:linux网站作者:mingjie1212
ubuntu 14.04上安装tty.js报错:
从报错log,定位到node -e "require('nan')"
 
参考:https://github.com/voodootikigod/node-serialport/issues/301
 'node' command fails on Ubuntu #301
The following command in binding.gyp is no more compatible with Ubuntu 13.10 with NodeJS v0.10.x (in my case)
node -e "require(\'nan\')"
I quote the warnings
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.0-15-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/trysk/Workspace/TextDuino/node_modules/serialport
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.9
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
It appears that nodejs -e "require(\'nan\')" solves the problem on that platform.
 
解决办法:
sudo apt-get update && sudo apt-get install nodejs-legacy
 
本文永久更新地址:http://www.linuxdiyf.com/linux/22005.html