Npm 节点gyp重建失败

Npm 节点gyp重建失败,npm,node-gyp,Npm,Node Gyp,我正在尝试安装一个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-cli

我正在尝试安装一个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
非常感谢您的帮助

问候


卢克

看来你和一个阻碍你前进的旧包裹有冲突

试试下面的命令帮助我解决了这个问题,可能对你也有帮助。。。这些命令可能需要sudo访问权限

npm cache clean -f
npm install -g n
n stable
npm install npm -g

因此,上述解决了当包版本中存在任何冲突时的问题。。。。但是通过查看日志,它会显示
make:g++:Command not found
,这意味着您需要安装开发人员工具

您是否尝试过通过apt get install安装node gyp:

apt-get install node-gyp

找不到命令g++,因此您需要安装g++包(以及build essential,其中包括生成/编译程序所需的其他包):

sudo-apt-get-install-build-essential g++