我试图安装一个nodejs应用程序,但我一直得到关于" node-gyp"的错误。没有重建。
我对nodejs了解不多,除了我可以在我的本地机器上工作正常但我无法弄清楚为什么它不会在服务器上运行。
Ubuntu 14.04 节点v0.12.5 npm v2.11.2
> ws@0.4.32 install /root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
make: Leaving directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
> ref@1.0.2 install /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
> node-gyp rebuild
make: Entering directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
CXX(target) Release/obj.target/binding/src/binding.o
make: g++: Command not found
make: *** [Release/obj.target/binding/src/binding.o] Error 127
make: Leaving directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.13.0-52-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
gyp ERR! node -v v0.12.5
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Linux 3.13.0-52-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! ref@1.0.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref@1.0.2 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the ref 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 ref
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/banquo-server/npm-debug.log
任何帮助都非常感激。
此致
路
答案 0 :(得分:0)
您似乎与较旧的软件包发生了冲突。
尝试以下命令帮助我解决问题,也可能对您有帮助......这些命令可能需要 sudo 访问
npm cache clean -f
npm install -g n
n stable
npm install npm -g
所以上面解决了包版本中存在任何冲突的问题....但是通过查看日志,它说make: g++: Command not found
这意味着您需要安装开发人员工具
答案 1 :(得分:0)
你试过通过apt-get install安装node-gyp:
apt-get install node-gyp
答案 2 :(得分:0)
找不到命令g ++,因此您需要安装g ++包(以及build-essential,其中包括构建/编译程序所需的其他包):
sudo apt-get install build-essential g++