npm ERR! code 1
npm ERR! path D:\myProject\mall-admin-web-master\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.5.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:\myProject\mall-admin-web-master\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack at PythonFinder. (D:\myProject\mall-admin-web-master\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack at D:\myProject\mall-admin-web-master\node_modules\graceful-fs\polyfills.js:284:29
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:195:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "D:\nodejs\node.exe" "D:\myProject\mall-admin-web-master\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\myProject\mall-admin-web-master\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.5.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
这种情况怎么解决
node-sass 有没有装!
包下载的安全问题,猜测npm下载默认是拉取安全的包到node_modules,因此如果被判定不够安全,不会被拉取下来,并且会抛出一个错误记录,
执行这个命令sudo npm i --unsafe-perm
如果还报错,可能是node-sass没安装好,可以使用下面命令进行安装:
前提时cpm已经安装了cnpm install node-sass@latest
如果cnpm没有安装可以执行这个命令npm install cnpm -g
先清理缓存:npm cache clean --force
然后升级版本:npm install -g npm
重新安装: npm install -g cnpm --registry=http://registry.npm.taobao.org
一次不行可以反复几次,就可以进行npm install操作了
试试运行这个 npm install --global --production windows-build-tools