执行npm install报错 (我已经用npm设置过淘宝源)
npm ERR! code 1
npm ERR! path F:\工作项目\new-project\ry-cloud\RuoYi-Cloud\ruoyi-ui\node_modules\fibers
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@14.17.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 (F:\工作项目\new-project\ry-cloud\RuoYi-Cloud\ruoyi-ui\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (F:\工作项目\new-project\ry-cloud\RuoYi-Cloud\ruoyi-ui\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack at callback (F:\工作项目\new-project\ry-cloud\RuoYi-Cloud\ruoyi-ui\node_modules\graceful-fs\polyfills.js:299:20)
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (fs.js:192:21)
npm ERR! gyp ERR! System Windows_NT 10.0.17134
npm ERR! gyp ERR! command "E:\\nodejs\\node.exe" "F:\\工作项目\\new-project\\ry-cloud\\RuoYi-Cloud\\ruoyi-ui\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd F:\工作项目\new-project\ry-cloud\RuoYi-Cloud\ruoyi-ui\node_modules\fibers
npm ERR! gyp ERR! node -v v14.17.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! E:\nodejs\node_cache\_logs\2021-05-19T09_23_18_909Z-debug.log
1.安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
2.执行cnpm install
cnpm install
可以看见成功了
3..执行cnpm run dev
cnpm run dev
vue项目启动成功
1.为什么执行npm install报错,而cnpm install不报错,原因不了解,因为我已经给npm设置了淘宝源的。以后如果npm install报错的话,可以先不忙卸载,试试cnpm
2.走了弯路
看见有这俩玩意,我百度一下,大都说python环境有问题或没得python。我跟着好几篇文章搞,安装python,设置python环境变量啊等, 结果 搞了半天不得行,还报了一系列新错。
当时都想重新卸载node了(因为设置了一些环境变量,怕对后面有影响)
死马当活马医,请教公司大佬,他如果不能解决的话就直接卸载重装。结果他二话不说上来直接安装cnpm,用cnpm install 就OK了