项目场景: gyp verb check python checking for Python executable python2 in the PATH

项目场景: gyp verb check python checking for Python executable “python2” in the PATH

环境

​ node v16.15.0

​ npm 8.5.5

npm install 报错

问题描述

gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\demandindex\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\demandindex\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\demandindex\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\demandindex\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\demandindex\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\demandindex\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Program Files\python\python.EXE
npm ERR! gyp verb check python version `C:\Program Files\python\python.EXE -c "import platform; print(platform.python_version());"` returned: "3.8.6\r\n"

最开始以为是缺少python2.7

安装了 python2.7 和 windows-build-tools以后依然报错

原因分析:

node-sass和 node版本不对应

我之前的node-sass版本是4.7.2

NodeJSSupported node-sass versionNode Module
Node 177.0+102
Node 166.0+93
Node 155.0+, <7.088
Node 144.14+83
Node 134.13+, <5.079
Node 124.12+, <8.072
Node 114.10+, <5.067
Node 104.9+, <6.064
Node 84.5.3+, <5.057
Node <8<5.0<57

解决方案:

node-sass 版本修改6.0.1

在执行 npm install

解决

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
乘风的头像乘风管理团队
上一篇 2023年3月10日
下一篇 2023年3月10日

相关推荐