当前位置:首页 » 《资源分享》 » 正文

npm install报错:ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1

23 人参与  2024年09月19日 15:21  分类 : 《资源分享》  评论

点击全文阅读


项目场景:

今天从GitHub上拉了一个vue前端项目,也就是人人开源的前端项目。在进行npm install的时候给我报了一大堆错误

D:\Spring-Cloud-Platform-UI-dev>npm installnpm ERR! code CERT_HAS_EXPIREDnpm ERR! errno CERT_HAS_EXPIREDnpm ERR! request to https://registry.npm.taobao.org/@types%2fsemver failed, reason: certificate has expirednpm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2024-07-26T01_13_03_869Z-debug.log

一开始,清理缓存,去官网看一下node和npm的对应版本是否正确,以下是node官网上node和npm的对应版本。

官网地址:
https://nodejs.org/zh-cn/download/releases

对应版本:
在这里插入图片描述

试过了 如下办法

查看npm镜像设置
npm config get registry
将npm设置为淘宝镜像
npm config set registry https://registry.npm.taobao.org
再次查看npm镜像设置
npm config get registry
重新install
npm install

后面又找了一下别人的解决方法:

第一步:解决方法如下: 清除npm缓存
npm cache clean --force
更换npm镜像源:
 npm config set registry https://mirrors.huaweicloud.com/repository/npm/

1、然后 运行 npm install 后报错如下:

gyp ERR! configure errorgyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.gyp ERR! stack     at PythonFinder.failNoPython (D:\Spring-Cloud-Platform-UI-dev\node_modules\node-gyp\lib\configure.js:484:19)gyp ERR! stack     at PythonFinder.<anonymous> (D:\Spring-Cloud-Platform-UI-dev\node_modules\node-gyp\lib\configure.js:509:16)gyp ERR! stack     at D:\Spring-Cloud-Platform-UI-dev\node_modules\graceful-fs\polyfills.js:284:29gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:183:21)gyp ERR! System Windows_NT 10.0.19045gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\springProject\\Spring-Cloud-Platform-UI-dev\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="gyp ERR! cwd D:\Spring-Cloud-Platform-UI-dev\node_modules\node-sassgyp ERR! node -v v14.16.0gyp ERR! node-gyp -v v3.8.0gyp ERR! not okBuild failed with error code: 1npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! node-sass@4.9.4 postinstall: `node scripts/build.js`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the node-sass@4.9.4 postinstall script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2024-07-26T01_26_18_216Z-debug.log

最后 发现是 node-sass 安装源的问题,运行如下:

npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass

2、然后 运行 npm install 后报错如下:

gyp ERR! configure errorgyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.gyp ERR! stack     at PythonFinder.failNoPython (D:\Spring-Cloud-Platform-UI-dev\node_modules\node-gyp\lib\configure.js:484:19)gyp ERR! stack     at PythonFinder.<anonymous> (D:\Spring-Cloud-Platform-UI-dev\node_modules\node-gyp\lib\configure.js:509:16)gyp ERR! stack     at D:\Spring-Cloud-Platform-UI-dev\node_modules\graceful-fs\polyfills.js:284:29gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:183:21)gyp ERR! System Windows_NT 10.0.19045gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\springProject\\Spring-Cloud-Platform-UI-dev\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="gyp ERR! cwd D:\Spring-Cloud-Platform-UI-dev\node_modules\node-sassgyp ERR! node -v v14.16.0gyp ERR! node-gyp -v v3.8.0gyp ERR! not okBuild failed with error code: 1npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! node-sass@4.9.4 postinstall: `node scripts/build.js`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the node-sass@4.9.4 postinstall script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2024-07-26T01_26_18_216Z-debug.log

3、仔细看了控制台报错,最后发现是因为缺了node-sass 的包。

npm install node-sass

搞定,完结,撒花 !


点击全文阅读


本文链接:http://m.zhangshiyu.com/post/161776.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最新文章

  • 我转岗做文员后,自称尸语者的男友小青梅急了江晚晴陆景行完本_我转岗做文员后,自称尸语者的男友小青梅急了(江晚晴陆景行)
  • 前传苏小朵卫献知续集:全文+番外穿成炮灰原配,首长白天总拉窗帘:结局+番外新上热文
  • 犹若清风梦了云列表_犹若清风梦了云(晏临渊叶知薇谢执玉)
  • 春风不渡无心人结局+完结(林至南霍以峦)_春风不渡无心人结局+完结(林至南霍以峦)
  • 犹若清风梦了云晏临渊全新叶知薇
  • 被太子捡到后,小娇花她又野又飒小说(钟离廷如花花)最近更新(被太子捡到后,小娇花她又野又飒)整本无套路阅读
  • 全书浏览盛景如诗不歇免费(顾崇高夏凌霜)_盛景如诗不歇免费(顾崇高夏凌霜)全书结局
  • 夏凌霜的盛景如诗不歇结局+番外顾崇高夏凌霜全书在线
  • 开局逆天改命,不是哥们你奇门真通神?后续+完结_叶小道陈笑笑强推_小说后续在线阅读_无删减免费完结_
  • 相公考中状元,我却自甘为青楼花魁杀他全家全文+后续_裴知夜裴家云娘结局_小说后续在线阅读_无删减免费完结_
  • 全书浏览我转岗做文员后自称尸语者的男友小青梅急了篇(江晚晴陆景行韩依依)_我转岗做文员后自称尸语者的男友小青梅急了篇(江晚晴陆景行韩依依)全书结局
  • 碰瓷糙野硬汉后,八零美人三年抱俩小说(沈茵茵霍枭)+起点章节(碰瓷糙野硬汉后,八零美人三年抱俩)阅读

    关于我们 | 我要投稿 | 免责申明

    Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1