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
 

 

 

 

 

 

 

 

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