- 记录一下 npm i 的时候报错,报错信息如下
npm ERR! code 1 npm ERR! path D:workspaceexchangeexchange-webexchange-web-uinode_modulesnode-sass npm ERR! command failed npm ERR! command C:Windowssystem32cmd.exe /d /s /c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@3.8.0 npm ERR! gyp info using node@13.6.0 | win32 | x64 npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. npm ERR! gyp ERR! stack at PythonFinder.failNoPython (D:workspaceexchangeexchange-webexchange-web-uinode_modulesnode-gyplibconfigure.js:484:19) npm ERR! gyp ERR! stack at PythonFinder.(D:workspaceexchangeexchange-webexchange-web-uinode_modulesnode-gyplibconfigure.js:509:16) npm ERR! gyp ERR! stack at callback (D:workspaceexchangeexchange-webexchange-web-uinode_modulesgraceful-fspolyfills.js:299:20) npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (fs.js:166:21) npm ERR! gyp ERR! System Windows_NT 10.0.19043 npm ERR! gyp ERR! command "D:\software\node\node.exe" "D:\workspace\exchange\exchange-web\exchange-web-ui\node_modules\node-gyp\bin\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd D:workspaceexchangeexchange-webexchange-web-uinode_modulesnode-sass npm ERR! gyp ERR! node -v v13.6.0 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! not ok
解决方法:
前端的package.json 文件中 这两个版本是如下:
“node-sass”: “^4.14.0”,
“script-loader”: “^0.7.2”,
因为我下载的是node16 根本下载不下来node-sass
1、卸载node16
2、安装node v12.13.1
3、查看C: C盘的根目录下是不是有Python27.如果没有安装一下。https://www.python.org/downloads/release/python-2712/
4、在系统变量里配置一下path
5、随后删除一下之前的node_model。
6、重新npm i



