1.从网上git下来后,运行时出现
npm WARN EBADENGINE package: '@achrinza/node-ipc@9.2.2', npm WARN EBADENGINE required: { node: '8 || 10 || 12 || 14 || 16 || 17' }, npm WARN EBADENGINE current: { node: 'v18.15.0', npm: '9.5.0' } npm WARN EBADENGINE }
原因:node.js版本不匹配
解决:卸载重装
How to completely remove node.js from Windows - Stack Overflow
2.重装node.js后运行出现
npm ERR! gyp verb check python checking for Python executable "C:\Users\fang\AppData\Local\Microsoft\WindowsApps\python.exe" in the PATH npm ERR! gyp verb `which` failed Error: not found: C:\Users\fang\AppData\Local\Microsoft\WindowsApps\python.exe
解决:cmd 运行where python.exe,然后根据出现的地址重新set
C:\Users\fang>set PYTHON=D:\Program Files\Python311\python.exe\python.exe
3.npm ERR! path D:\mall-admin-web\node_modules\node-sass
解决方法:
npm install -g node-gyp
更新node-gyp:您正在使用的node-gyp版本(v3.8.0)非常旧,可能与您的Node.js版本(v16.0.0)不完全兼容。执行以下命令将node-gyp更新为最新版本:
npm uninstall node-sass
更新node-sass: node-sass包已弃用,取而代之的是sass。卸载node-sass并安装sass:
npm install sass
重新运行npm install:完成以上步骤后,在你的项目目录下重新运行npm install。
这些步骤应该可以解决问题,并允许您成功地为sass包构建本机扩展。
node-sass 下载失败 解决方案 · Issue #24 · PanJiaChen/vue-element-admin (github.com)