npm 节点gyp重建失败

68de4m5k  于 2023-03-30  发布在  其他
关注(0)|答案(4)|浏览(173)

我试图安装一个nodejs应用程序,但我一直得到关于“node-gyp”无法重建的相同错误。
我对nodejs了解不多,除了我可以让它在我的本地机器上工作很好,但我不知道为什么它不能在服务器上运行。
Ubuntu 14.04 Node 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
vuktfyat

vuktfyat1#

您似乎与一个旧的软件包有冲突,该软件包正在碍事。
尝试下面的命令帮助我解决了这个问题,可能也会帮助你……这些命令可能需要sudo访问

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

所以上面解决了包版本中存在任何冲突的问题....但通过查看日志,它显示为make: g++: Command not found,这意味着您需要安装开发人员工具

bcs8qyzn

bcs8qyzn2#

你有没有试过通过apt-get install安装node-gyp:

apt-get install node-gyp
flvlnr44

flvlnr443#

找不到命令g++,所以你需要安装g++包(沿着build-essential,其中包括构建/编译程序所需的其他包):
sudo apt-get install build-essential g++

pobjuy32

pobjuy324#

yarn install为我修复了它,希望这对我有帮助

相关问题