具体报错信息
运行项目时提示没有安装node-sass:
安装node-sass报错,有关python环境
gyp ERR! configure error
gyp ERR! stack Error: Command failed: F:\Python38\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:308:12)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "F:\\Program Files\\nodejs\\node.exe" "D:\\VueProject\\xiaoguan-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "
--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\VueProject\xiaoguan-vue\node_modules\node-sass
gyp ERR! node -v v14.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
解决办法
错误原因:原因是问题无法下载node,使用淘宝镜像源即可。
具体操作:
//卸载
npm uninstall node-sass
//安装
npm i node-sass@4.14.1 --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
建议"node-sass"
: 安装"^4.14.1", "sass-loader"
: 安装"^7.1.0",版本过高的话也会报错。
附安装成功截图: