繁体   English   中英

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

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

我正在尝试安装节点模块bcrypt

所以我运行了以下命令

sudo npm install bcrypt

有了这个我得到以下错误:

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

我试图删除所有模块,并且sudo npm install ive也试图重建,但是没有结果有人可以帮助我吗?

只需安装build-essential软件包:

sudo apt install build-essential

并安装bcrypt:

npm i -S bcrypt

在搜索Google一小时后,我做了以下三件事,并且在最后一个之后开始工作。 我知道您不在Windows上,但是也许其他来这里的人会像我一样从Windows机器上看到此消息。

1.)我确保将Python下载到C:\\ Python2.7并设置了Python的路径变量。

2.)我做到了

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

它实际上只是通过了本篇文章的Python部分,下一次安装(无论是什么,我都不知道,因为花费了太长时间)是说它安装了一个小时,所以我只是停止了它,然后进行下一步3.幸好它奏效了。

3.)我将以下内容添加到package.json中,如另一个github线程所示。 完成此操作后,确保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