win10下安裝web3失敗問題

1.在安裝web3上面出錯如下:

H:\nodejsData>npm install web3

> [email protected] postinstall H:\nodejsData\node_modules\web3
> lerna bootstrap

lerna info version 2.1.2
lerna info Bootstrapping 19 packages
lerna info lifecycle preinstall
lerna info Installing external dependencies
lerna ERR! execute Error: Command failed: npm install
lerna ERR! execute npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
lerna ERR! execute gyp ERR! configure error
lerna ERR! execute gyp ERR! stack Error: Can’t find Python executable “F:\SoftWare\python\python.EXE”, you can set the PYTHON env variable.
lerna ERR! execute gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
lerna ERR! execute gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
lerna ERR! execute gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
lerna ERR! execute gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
lerna ERR! execute gyp ERR! System Windows_NT 10.0.14393
lerna ERR! execute gyp ERR! command “C:\\Program Files\\nodejs\\node.exe” “C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js” “rebuild”
lerna ERR! execute gyp ERR! cwd H:\nodejsData\node_modules\web3\packages\web3-eth-accounts\node_modules\scrypt
lerna ERR! execute gyp ERR! node -v v8.4.0
lerna ERR! execute gyp ERR! node-gyp -v v3.6.2
lerna ERR! execute gyp ERR! not ok
lerna ERR! execute npm WARN web3-eth-accounts No repository field.
lerna ERR! execute npm WARN web3-eth-accounts No license field.
lerna ERR! execute
lerna ERR! execute npm ERR! code ELIFECYCLE
lerna ERR! execute npm ERR! errno 1
lerna ERR! execute npm ERR! [email protected] install: `node-gyp rebuild`
lerna ERR! execute npm ERR! Exit status 1
lerna ERR! execute npm ERR!
lerna ERR! execute npm ERR! Failed at the [email protected] install script.
lerna ERR! execute npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
lerna ERR! execute
lerna ERR! execute npm ERR! A complete log of this run can be found in:
lerna ERR! execute npm ERR!     C:\Program Files\nodejs\node_cache\_logs\2017-09-02T23_05_22_987Z-debug.log
lerna ERR! execute
lerna ERR! execute > [email protected] preinstall H:\nodejsData\node_modules\web3\packages\web3-eth-accounts\node_modules\scrypt
lerna ERR! execute > node node-scrypt-preinstall.js
lerna ERR! execute
lerna ERR! execute
lerna ERR! execute > [email protected] install H:\nodejsData\node_modules\web3\packages\web3-eth-accounts\node_modules\scrypt
lerna ERR! execute > node-gyp rebuild
lerna ERR! execute
lerna ERR! execute
lerna ERR! execute H:\nodejsData\node_modules\web3\packages\web3-eth-accounts\node_modules\scrypt>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js” rebuild )  else (node “” rebuild )
lerna ERR! execute
lerna ERR! execute     at Promise.all.then.arr (H:\nodejsData\node_modules\execa\index.js:236:11)
lerna ERR! execute     at <anonymous>
lerna ERR! execute     at process._tickCallback (internal/process/next_tick.js:188:7)
lerna ERR! execute  callback with error
lerna ERR! execute  { Error: Command failed: npm install
lerna ERR! execute npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
lerna ERR! execute gyp ERR! configure error
lerna ERR! execute gyp ERR! stack Error: Can’t find Python executable “F:\SoftWare\python\python.EXE”, you can set the PYTHON env variable.
lerna ERR! execute gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
lerna ERR! execute gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
lerna ERR! execute gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
lerna ERR! execute gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
lerna ERR! execute gyp ERR! System Windows_NT 10.0.14393
lerna ERR! execute gyp ERR! command “C:\\Program Files\\nodejs\\node.exe” “C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js” “rebuild”
lerna ERR! execute gyp ERR! cwd H:\nodejsData\node_modules\web3\packages\web3-eth-accounts\node_modules\scrypt
lerna ERR! execute gyp ERR! node -v v8.4.0
lerna ERR! execute gyp ERR! node-gyp -v v3.6.2
lerna ERR! execute gyp ERR! not ok
lerna ERR! execute npm WARN web3-eth-accounts No repository field.
lerna ERR! execute npm WARN web3-eth-accounts No license field.
lerna ERR! execute
lerna ERR! execute npm ERR! code ELIFECYCLE
lerna ERR! execute npm ERR! errno 1
lerna ERR! execute npm ERR! [email protected] install: `node-gyp rebuild`
lerna ERR! execute npm ERR! Exit status 1
lerna ERR! execute npm ERR!
lerna ERR! execute npm ERR! Failed at the [email protected] install script.
lerna ERR! execute npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
lerna ERR! execute
lerna ERR! execute npm ERR! A complete log of this run can be found in:
lerna ERR! execute npm ERR!     C:\Program Files\nodejs\node_cache\_logs\2017-09-02T23_05_22_987Z-debug.log
lerna ERR! execute
lerna ERR! execute > [email protected] preinstall H:\nodejsData\node_modules\web3\packages\web3-eth-accounts\node_modules\scrypt
lerna ERR! execute > node node-scrypt-preinstall.js
lerna ERR! execute
lerna ERR! execute
lerna ERR! execute > [email protected] install H:\nodejsData\node_modules\web3\packages\web3-eth-accounts\node_modules\scrypt
lerna ERR! execute > node-gyp rebuild
lerna ERR! execute
lerna ERR! execute
lerna ERR! execute H:\nodejsData\node_modules\web3\packages\web3-eth-accounts\node_modules\scrypt>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js” rebuild )  else (node “” rebuild )
lerna ERR! execute
lerna ERR! execute     at Promise.all.then.arr (H:\nodejsData\node_modules\execa\index.js:236:11)
lerna ERR! execute     at <anonymous>
lerna ERR! execute     at process._tickCallback (internal/process/next_tick.js:188:7)
lerna ERR! execute   stack: ‘Error: Command failed: npm install\nnpm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue\ngyp ERR! configure error \ngyp ERR! stack Error: Can\’t find Python executable “F:\\SoftWare\\python\\python.EXE”, you can set the PYTHON env variable.\ngyp ERR! stack     at PythonFinder.failNoPython (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:483:19)\ngyp ERR! stack     at PythonFinder.<anonymous> (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:508:16)\ngyp ERR! stack     at C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\graceful-fs\\polyfills.js:284:29\ngyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)\ngyp ERR! System Windows_NT 10.0.14393\ngyp ERR! command “C:\\\\Program Files\\\\nodejs\\\\node.exe” “C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js” “rebuild”\ngyp ERR! cwd H:\\nodejsData\\node_modules\\web3\\packages\\web3-eth-accounts\\node_modules\\scrypt\ngyp ERR! node -v v8.4.0\ngyp ERR! node-gyp -v v3.6.2\ngyp ERR! not ok \nnpm WARN web3-eth-accounts No repository field.\nnpm WARN web3-eth-accounts No license field.\n\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! [email protected] install: `node-gyp rebuild`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the [email protected] install script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     C:\\Program Files\\nodejs\\node_cache\\_logs\\2017-09-02T23_05_22_987Z-debug.log\n\n> [email protected] preinstall H:\\nodejsData\\node_modules\\web3\\packages\\web3-eth-accounts\\node_modules\\scrypt\n> node node-scrypt-preinstall.js\n\n\n> [email protected] install H:\\nodejsData\\node_modules\\web3\\packages\\web3-eth-accounts\\node_modules\\scrypt\n> node-gyp rebuild\n\n\r\nH:\\nodejsData\\node_modules\\web3\\packages\\web3-eth-accounts\\node_modules\\scrypt>if not defined npm_config_node_gyp (node “C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\node-gyp-bin\\\\..\\..\\node_modules\\node-gyp\\bin\\node-gyp.js” rebuild )  else (node “” rebuild ) \r\n\n    at Promise.all.then.arr (H:\\nodejsData\\node_modules\\execa\\index.js:236:11)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:188:7)’,
lerna ERR! execute   code: 1,
lerna ERR! execute   killed: false,
lerna ERR! execute   stdout: ‘\n> [email protected] preinstall H:\\nodejsData\\node_modules\\web3\\packages\\web3-eth-accounts\\node_modules\\scrypt\n> node node-scrypt-preinstall.js\n\n\n> [email protected] install H:\\nodejsData\\node_modules\\web3\\packages\\web3-eth-accounts\\node_modules\\scrypt\n> node-gyp rebuild\n\n\r\nH:\\nodejsData\\node_modules\\web3\\packages\\web3-eth-accounts\\node_modules\\scrypt>if not defined npm_config_node_gyp (node “C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\node-gyp-bin\\\\..\\..\\node_modules\\node-gyp\\bin\\node-gyp.js” rebuild )  else (node “” rebuild ) \r\n’,
lerna ERR! execute   stderr: ‘npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue\ngyp ERR! configure error \ngyp ERR! stack Error: Can\’t find Python executable “F:\\SoftWare\\python\\python.EXE”, you can set the PYTHON env variable.\ngyp ERR! stack     at PythonFinder.failNoPython (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:483:19)\ngyp ERR! stack     at PythonFinder.<anonymous> (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:508:16)\ngyp ERR! stack     at C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\graceful-fs\\polyfills.js:284:29\ngyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)\ngyp ERR! System Windows_NT 10.0.14393\ngyp ERR! command “C:\\\\Program Files\\\\nodejs\\\\node.exe” “C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js” “rebuild”\ngyp ERR! cwd H:\\nodejsData\\node_modules\\web3\\packages\\web3-eth-accounts\\node_modules\\scrypt\ngyp ERR! node -v v8.4.0\ngyp ERR! node-gyp -v v3.6.2\ngyp ERR! not ok \nnpm WARN web3-eth-accounts No repository field.\nnpm WARN web3-eth-accounts No license field.\n\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! [email protected] install: `node-gyp rebuild`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the [email protected] install script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     C:\\Program Files\\nodejs\\node_cache\\_logs\\2017-09-02T23_05_22_987Z-debug.log\n’,
lerna ERR! execute   failed: true,
lerna ERR! execute   signal: null,
lerna ERR! execute   cmd: ‘npm install’,
lerna ERR! execute   timedOut: false }
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
npm WARN Error: EPERM: operation not permitted, scandir ‘H:\nodejsData\node_modules\read-pkg-up\node_modules’
npm WARN  { Error: EPERM: operation not permitted, scandir ‘H:\nodejsData\node_modules\read-pkg-up\node_modules’
npm WARN   stack: ‘Error: EPERM: operation not permitted, scandir \’H:\\nodejsData\\node_modules\\read-pkg-up\\node_modules\”,
npm WARN   errno: -4048,
npm WARN   code: ‘EPERM’,
npm WARN   syscall: ‘scandir’,
npm WARN   path: ‘H:\\nodejsData\\node_modules\\read-pkg-up\\node_modules’ }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `lerna bootstrap`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall 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!     C:\Program Files\nodejs\node_cache\_logs\2017-09-02T23_05_37_212Z-debug.log

糾結了一個星期才解決了,① 首先可以先通過 npm cache verify 清理下快取,在進行安裝

② 如果還是安裝失敗可以嘗試 —   npm install [email protected]^0.20.0  或者 npm install v6  ,進行安裝npm install web3

③ 個人是通過 npm install [email protected]^0.20.0 安裝成功的