我将此行添加到 package.json
"bcrypt": "0.8.0"
已安装' 节点'通过apt-get;
打包在项目目录
中发布之后npm install
得到了这个输出:
dog@ubuntu:~/Documents/sources/shopsforeveryone/Code$ npm install
npm http GET https://registry.npmjs.org/bcrypt/0.8.0
npm http 200 https://registry.npmjs.org/bcrypt/0.8.0
npm http GET https://registry.npmjs.org/bcrypt/-/bcrypt-0.8.0.tgz
npm http 200 https://registry.npmjs.org/bcrypt/-/bcrypt-0.8.0.tgz
npm http GET https://registry.npmjs.org/bindings/1.0.0
npm http GET https://registry.npmjs.org/nan/1.3.0
npm http 304 https://registry.npmjs.org/nan/1.3.0
npm http 304 https://registry.npmjs.org/bindings/1.0.0
> bcrypt@0.8.0 install /home/dog/Documents/sources/shopsforeveryone/Code/node_modules/bcrypt
> node-gyp rebuild
/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:797:12)
gyp ERR! System Linux 3.13.0-39-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/dog/Documents/sources/shopsforeveryone/Code/node_modules/bcrypt
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
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
npm ERR! weird error 1
npm ERR! not ok code 0
由于节点而失败,但节点不能过时。有什么问题?
答案 0 :(得分:3)
您很可能还需要sudo apt-get install nodejs-legacy
为依赖二进制为node
而不是nodejs
的脚本获取正确的符号链接。
另外作为旁注,由于node.js仍然比大多数Linux发行版存储库更快地移动,您可以考虑添加Chris Lea的PPA以保持最新(尤其是获取最新的安全修复程序 - - 例如POODLE缓解):
sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs
更新:现在建议使用NodeSource repos,它还提供最新版本的节点以及更广泛的Linux发行版。