npm install报错, node-sass

在Windows系统中,使用npm安装node-sass时遇到配置错误,找不到Python执行文件。通过设置npm配置,将sass_binary_site指向淘宝镜像源,解决了报错并成功执行npm install。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如题,详细报错如下:
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 (D:\vue-style-codebase-prerender\node_mo
gyp ERR! stack at PythonFinder. (D:\vue-style-codebase-prerender\node_mod
gyp ERR! stack at callback (D:\vue-style-codebase-prerender\node_modules\graceful-fs
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:183:21)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command “D:\Program Files\nodejs\node.exe” “D:\vue-style-codebase-prerendeags=” “–libsass_ldflags=” “–libsass_library=”
gyp ERR! cwd D:\vue-style-codebase-prerender\node_modules\node-sass
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\chokidar\node_modules
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\n
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 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\neal\AppData\Roaming\npm-cache_logs\2021-11-10T12_44_26_654Z-debug.log
一顿操作,最后找到解决方法:
因为node-sass报错
npm ERR! node-sass@4.14.1 postinstall: node scripts/build.js

解决方案:
输入如下命令:

npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass

重新运行npm install即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值