npm install报错 缺少python

报错信息:

javascript 复制代码
Building:E:tols'nvm'nodesnodeexe : ode emos ant-desig-we-eos odemodules node-gyp'bintnode-gp.s rebld -verbose -Libsass_ext= --Libsas_cflags-
lags= --libsass_library=gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli'E: toolsnvm  nodes  node .exe!gyp verb cli'E:\\Codellemosllant-design-vue-emosllnode_moduleslnode-gypllbinllnode-gyp.js'
gyp verb cli'rebuild'gyp verb cli--verbose''--libsass_ext=',gyp verb cligyp verb clii--libsass_cflags='
gyp verb cli
'--libsass ldflags='
gyp verb cli
'--libsass library=
gyp verb cli ]
gyp info using node-gyp@3.8.0gyp info using node@14.17.0  win32  x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
which' failed Error: not found: python2gyp verb
at getNotFoundError (E:\Codeemoslant-design-vue-emosnode_modules\which\which.js:13:12)
gyp verbwhich*failed
gyp verbwhich*failed
at F (E:\Code emos ant-design-vue-emos\nodmodules which which.is:68:19
at E (E:\Code emos ant-design-vue-emos\node.modules\which\which.js:80:29
which*failedgyp verb
gyp verbwhich*failedgyp verbfailedwhich'
at E:\Code\emos\ant-design-vue-emos\nodemodules\which\which.js:89:16
at E:\Code emos ant-design-vue-emos node.modules isexe index.js:42:5
gyp verbwhich' failedat E:\Code\emos\ant-design-vue-emos\node_modules\isexe\windows.js:36:5at FSRegCallback.oncomplete (fs.js:192:21)gyp verb which' failedpython2 Error: not found: python2

解决方法:

用管理员方式打开cmd:

javascript 复制代码
//先执行这个
npm install -g node-gyp
//在执行这个
npm install --global --production windows-build-tools

把node_modules中的全部删掉重新yarn install或者 npm install

相关推荐
时间的情敌几秒前
Vite 工作原理
1024程序员节
可惜我是水瓶座__3 分钟前
[Spark] TaskMetrics指标收集
spark·1024程序员节
qq_4696035895 分钟前
最新选题-基于Spark的二氧化碳排放量数据分析系统设计
1024程序员节·大数据项目·co2分析·二氧化碳分析
天下·第二23 分钟前
【大模型与OCR】配合应用的示例demo
1024程序员节
Greedy Alg24 分钟前
LeetCode 39. 组合总和
1024程序员节
im_AMBER29 分钟前
React 04
前端·react.js·前端框架·1024程序员节
lpfasd12330 分钟前
第四章-Tomcat线程模型与运行方式
1024程序员节
黑马源码库miui5208644 分钟前
场馆预定系统小程序
微信·微信小程序·小程序·1024程序员节
小陈爱建模1 小时前
2025妈妈杯大数据竞赛A题mathorcup大数据:集装箱智能破损检测问题手把手思路代码文章教学大学生数学建模
数学建模·1024程序员节