1. node-sass 安装包如下错误

  1. gyp ERR! configure error
  2. gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
  3. gyp ERR! stack File "", line 1
  4. gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
  5. gyp ERR! stack ^
  6. gyp ERR! stack SyntaxError: invalid syntax
  7. gyp ERR! stack at ChildProcess.exithandler (child_process.js:308:12)
  8. gyp ERR! stack at ChildProcess.emit (events.js:315:20)
  9. gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
  10. gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
  11. gyp ERR! System Windows_NT 10.0.19042
  12. gyp ERR! command "C:\software\nodejs\node.exe" "C:\Users\ICL\vscode\renren-fast-vue\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
  13. gyp ERR! cwd C:\Users\ICL\vscode\renren-fast-vue\node_modules\node-sass
  14. gyp ERR! node -v v14.16.0
  15. gyp ERR! not ok
  16. Build failed with error code: 1
  17. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
  18. npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
  19. npm ERR! code ELIFECYCLE
  20. npm ERR! errno 1
  21. npm ERR! node-sass@4.13.1 postinstall: node scripts/build.js
  22. npm ERR! Exit status 1
  23. npm ERR!
  24. npm ERR! Failed at the node-sass@4.13.1 postinstall script.
  25. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  26. npm ERR! A complete log of this run can be found in:

解决方案:
1 设置变量 sass_binary_site,指向淘宝镜像地址

  1. npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
  1. 执行 npm install 命令重新安装
    1. npm install