Bcrypt无法安装 [英] Bcrypt fails to install
问题描述
我在Ubuntu系统上安装名为"bcrypt"的npm软件包时遇到问题.
I am having problems installing an npm package called "bcrypt" on my Ubuntu system.
这就是我所做的:
sudo apt-get更新
sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install bcrypt
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install bcrypt
这就是我得到的:
键入时:sudo npm install bcrypt
when typing: sudo npm install bcrypt
npm http GET https://registry.npmjs.org/bcrypt
npm http 304 https://registry.npmjs.org/bcrypt
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/gatsu/salongapp/salongapp/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-35-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/gatsu/salongapp/salongapp/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
该软件包不会不放置在此文件夹中:
The package does not get placed in this folder:
/home/gatsu/salongapp/salongapp/node_modules/bcrypt
/home/gatsu/salongapp/salongapp/node_modules/bcrypt
有什么想法吗?
推荐答案
在ubuntu中,如果您使用apt安装nodejs,则nodejs的命令将为 nodejs
,而通常用于nodejs的命令行名称为<代码>节点代码>.
in ubuntu if you install nodejs using apt, the command for nodejs will be nodejs
while commonly command line name used for nodejs is node
.
在这里,bcrypt假定该命令为 node
(该节点不可用).
Here, bcrypt assumes the command as node
which is not available.
尝试像这样将nodejs的别名设置为节点 alias node ='nodejs'
然后尝试安装bcrypt sudo npm install bcrypt
Try setting alias for nodejs as node like this
alias node='nodejs'
and then try to install bcrypt
sudo npm install bcrypt
U可以在主文件夹的 .bash_aliases
文件中设置别名,以永久设置别名节点.
U can set aliases in .bash_aliases
file in home folder to permanently set the alias node.
这篇关于Bcrypt无法安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!