npm install一份vux cli代碼,報錯以下(只摘取部分信息)node
> node-zopfli@2.0.2 install D:\項目c\201708監控系統\code\ewater-monitor-app2\node_modules\node-zopfli > node-pre-gyp install --fallback-to-build node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Release/zopfli-v2.0.2-node-v57-win32-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for node-zopfli@2.0.2 and node@8.11.4 (node-v57 ABI, unknown) (falling back to source compile with node-gyp) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19) gyp ERR! stack at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
網上搜了不少方法,例如裝python,裝npm install --global --production windows-build-tools,等等,都無效python
後來發現問題在於node-zopfli,而node-zopfli是compression-webpack-plugin(此時用的版本是0.3.2)引用的依賴,compression-webpack-plugin最新版本是2.0.0,換到最新版後,問題解決,由於compression-webpack-plugin 2.0.0沒有依賴node-zopfliwebpack