gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

前端 npm install  報錯

gyp verb ensuring that file exists: C:\Python27\python.exe
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:\oumin\code\git\DTC_Connect_Digital\ea-cmb-connect-digital\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\oumin\code\git\DTC_Connect_Digital\ea-cmb-connect-digital\node_modules\node-gyp\lib\gyp ERR! stack     at callback (C:\oumin\code\git\DTC_Connect_Digital\ea-cmb-connect-digital\node_modules\graceful-fs\polyfills.js:299:20)
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\oumin\\code\\git\\DTC_Connect_Digital\\ea-cmb-connect-digital\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="     
gyp ERR! cwd C:\oumin\code\git\DTC_Connect_Digital\ea-cmb-connect-digital\node_modules\node-sass
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN The package styled-components is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
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:\Users\45188084\AppData\Roaming\npm-cache\_logs\2021-08-09T00_27_09_961Z-debug.log
PS C:\oumin\code\git\DTC_Connect_Digital\ea-cmb-connect-digital> npm install
npm WARN [email protected] requires a peer of commonmark@^0.27.0 || ^0.26.0 || ^0.24.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^15.3.0 || ^16.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@^15.3.0 || ^16.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package styled-components is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\chokidar\node_modules\fsevents):

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
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.

解決辦法: 安裝 python2 

安裝了之後,重新繼續即可。 注意 不要 在 同一個 控制檯 執行。

要 關閉,重新開啓即可

我的另一個解決辦法

我的環境node , 這個前端項目需要 SASS , 就從 git 上面下載了,然後配置了環境變量。

但是還是在 未配置環境變量的 控制檯 上面 執行命令,因此 識別不到 SASS 環境信息,因此才報錯的

其他輔助命令

如果還是報錯 可以先 清空緩存 然後 很可能就可以了。

出問題可以 卸載: npm uninstall

和清空緩存 :  npm cache clean --force

然後再次 npm install 重試

參考


https://stackoverflow.com/questions/54427540/npm-install-failed-at-the-node-sass3-13-1-postinstall-script


https://github.com/codecombat/codecombat/issues/4430

https://blog.csdn.net/weixin_36222137/article/details/78463543

https://stackoverflow.com/questions/23571257/cant-find-python-executable-python
 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章