前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Windows10下node-gyp rebuild报错

Windows10下node-gyp rebuild报错

作者头像
hotarugali
发布2022-03-01 15:22:23
6.1K0
发布2022-03-01 15:22:23
举报

1. 简介

在 Windows 10 下 npm install 失败,并报错:

代码语言:javascript
复制
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: connect ETIMEDOUT 104.20.22.46:443
gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
gyp ERR! System Windows_NT 10.0.19640
.....
gyp ERR! node -v v12.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.18 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.18 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

2. 解决

2.1 可能一

删除目录下的 node_modules 文件夹,再次 npm install 即可。

  • 原因:如果直接是从别处复制过来的项目,项目已有的 node_modules 文件夹,因此会造成兼容性冲突。

2.2 可能二

参见 github 上关于解决 node-gyp rebuild方案

  • Option 1 Install all the required tools and configurations using Microsoft’s windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).
  • Option 2 Install tools and configuration manually: Install Visual C++ Build Environment: Visual Studio Build Tools (using “Visual C++ build tools” workload) or Visual Studio 2017 Community (using the “Desktop development with C++” workload) Launch cmd, npm config set msvs_version 2017
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-07-20,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. 简介
  • 2. 解决
    • 2.1 可能一
      • 2.2 可能二
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档