npm install报错, node-sass

劳高爽
2023-12-01

如题,详细报错如下:
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即可

 类似资料: