简体   繁体   English

npm install bcrypt在node-gyp重建时失败

[英]npm install bcrypt fails at node-gyp rebuild

i am trying to install the node module bcrypt 我正在尝试安装节点模块bcrypt

so i ran the following command 所以我运行了以下命令

sudo npm install bcrypt

With this i get the following error: 有了这个我得到以下错误:

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.19.0-25-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/learningbankapi/src/node_modules/bcrypt
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "bcrypt"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@0.8.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt 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 bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/learningbankapi/src/npm-debug.log

I have attempted to remove all modules and sudo npm install ive also tried to rebuild but with no result can anyone help me out ? 我试图删除所有模块,并且sudo npm install ive也试图重建,但是没有结果有人可以帮助我吗?

Just install build-essential package : 只需安装build-essential软件包:

sudo apt install build-essential

and install bcrypt : 并安装bcrypt:

npm i -S bcrypt

After searching Google for an hour I did the following 3 things and it began to work after the very last one. 在搜索Google一小时后,我做了以下三件事,并且在最后一个之后开始工作。 I know you're not on Windows, but maybe someone else who comes here will see this from a Windows machine like I did. 我知道您不在Windows上,但是也许其他来这里的人会像我一样从Windows机器上看到此消息。

1.) I made sure Python was downloaded to C:\\Python2.7 and the path variable for Python was set. 1.)我确保将Python下载到C:\\ Python2.7并设置了Python的路径变量。

2.) I did 2.)我做到了

npm install --global --production windows-build-tools`

It actually only got through the Python part of this piece, the next install (whatever it may be, I don't know because it took too long) was saying it was installing for an hour, so I just stopped it and moved onto step 3. and thankfully it worked. 它实际上只是通过了本篇文章的Python部分,下一次安装(无论是什么,我都不知道,因为花费了太长时间)是说它安装了一个小时,所以我只是停止了它,然后进行下一步3.幸好它奏效了。

3.) I added the below to my package.json as shown on another github thread. 3.)我将以下内容添加到package.json中,如另一个github线程所示。 After doing this, and making sure the PYTHON variable was right it started to work. 完成此操作后,确保PYTHON变量正确,它开始起作用。 ``` ```

"env": {
    "PYTHON": "C:/python2.7"
  },
  "subdomain": "bcrypt-test",
  "engines": {
    "node": "0.6.x"
  },
  "repository": {},
  "domains": [],
  "databases": {}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM