Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了node.js – 无法在EC2上使用npm安装bcrypt大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在Amazon EC2实例上的Ubuntu Server 14.04上,执行npm install时出错.它无法在我的package.json中安装bcrypt(“bcrypt”:“^ 0.8.1”).

这是我的错误

> bcrypt@0.8.1 install /home/ubuntu/app/node_modules/bcrypt
> node-gyp rebuild

child_process: customFds option is deprecated,use stdio instead.
make: Entering directory `/home/ubuntu/app/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
make: g++: Command not found
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 127
make: Leaving directory `/home/ubuntu/app/node_modules/bcrypt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` Failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ubuntu/node-v0.12.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Linux 3.13.0-44-generic
gyp ERR! command "node" "/home/ubuntu/node-v0.12.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/app/node_modules/bcrypt
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok

解决方法

我只需要安装构建工具sudo apt-get install build-essential g

请注意,您必须apt-get update以避免在EC2上使用apt-get出现任何问题(否则您最终可能会遇到E:无法获取

然后npm@R_31_10696@,你很高兴!

大佬总结

以上是大佬教程为你收集整理的node.js – 无法在EC2上使用npm安装bcrypt全部内容,希望文章能够帮你解决node.js – 无法在EC2上使用npm安装bcrypt所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。