安装依赖时报错,死活装不上。
npm ERR! code 1
npm ERR! path C:\icsd\software\tent-admin\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.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@16.13.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
原因:项目的sass依赖问题,最新的 sass-loader@12.3.0 要求 webpack5.0.0,然而 vue 项目中 webpack 版本为 4.46.0
解决:
npm install -D sass-loader@^10 sass