Error

Scrypt npm install 失敗並出現錯誤 C 編譯器無法創建執行檔

  • July 30, 2018

你能幫我解決這個錯誤嗎?

dhcp-rhodes-571:harberger-token kishorpatil$ sudo npm install scrypt

> scrypt@6.0.3 preinstall /Users/kishorpatil/blockchain/radical-markets/harberger-token/node_modules/scrypt
> node node-scrypt-preinstall.js

Error: Error: Command failed: ./configure
configure: error: in `/Users/kishorpatil/blockchain/radical-markets/harberger-token/node_modules/scrypt/scrypt/scrypt-1.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details


> scrypt@6.0.3 install /Users/kishorpatil/blockchain/radical-markets/harberger-token/node_modules/scrypt
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/kishorpatil/blockchain/radical-markets/harberger-token/node_modules/scrypt/build'
gyp ERR! System Darwin 17.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kishorpatil/blockchain/radical-markets/harberger-token/node_modules/scrypt
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/Users/kishorpatil/blockchain/radical-markets/harberger-token/package.json'
npm WARN harberger-token No description
npm WARN harberger-token No repository field.
npm WARN harberger-token No README data
npm WARN harberger-token No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kishorpatil/.npm/_logs/2018-07-15T14_50_36_660Z-debug.log

呼..終於發現這是Mac上的NPM權限問題。我將以下目錄的所有權從 root 更改為我的使用者名:

  • sudo chown -R /usr/local/share/
  • sudo chown -R /usr/local/bin/
  • sudo chown -R /usr/local/lib/node_modules/

直到昨天我都有同樣的問題,請參考這個連結 https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules 我按照說明手動設置環境。如前所述,安裝帶有“用於桌面開發的 c++”工作負載的 vs 2017 社區版本並執行後續步驟。這麼多應該足以讓你跑步。謝謝,祝你好運👍

引用自:https://ethereum.stackexchange.com/questions/54408