拉取代码执行npm install 报错

来源:2-6 【讨论题】获取轮播图接口数据

STMF

2022-03-29

环境

windows10
node:16.14.0
npm:8.3.1
vue-cli:5.0.3

问题

从老师仓库拉取代码后执行 npm install 报错

npm ERR! code 1
npm ERR! path D:\code\front-end\vue-music\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@7.1.2
npm ERR! gyp info using node@16.14.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.3 found at "C:\Users\admin\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.14.0/node-v16.14.0-headers.tar.gz
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: connect ETIMEDOUT 104.20.23.46:443
npm ERR! gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\code\\front-end\\vue-music\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\code\front-end\vue-music\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\admin\AppData\Local\npm-cache\_logs\2022-03-29T07_32_19_747Z-debug-0.log

尝试解决

网上说缺少python,跟着安装了python,还是报错

写回答

1回答

ustbhuangyi

2022-03-30

试试 node v14.19.1,装

"node-sass": "^5.0.0",
"sass-loader": "^10.1.0",


1
1
STMF
谢谢老师,刚刚才发现这个问题我提交了两次,在我的另一个提问里面已经解决了
2022-03-30
共1条回复

Vue3开发企业级音乐Web App 明星讲师带你学大厂代码

慕课网明星讲师黄轶深度讲解 Vue3.0 ,提升的不止是Vue代码能力

2223 学习 · 1002 问题

查看课程