簡體   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