执行npm install报错无法连接到github.com的问题

IDEA包依赖错误的解决方法 一、包依赖错误 运行“Reimport All Maven Projects” 阅读详情
AI摘要

本文详细解析了在Docker环境下构建VueNode项目时遇到的npm install连接GitHub失败的问题,提供了修改git协议从git改为https的解决方案,并进一步解决了因sass源问题导致的构建错误。

报错信息如下:

Step 6/11 : RUN npm install
 ---> Running in fbea7757df0b
npm WARN ub-arc-mgmt@4.2.1 license should be a valid SPDX license expression

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t git://github.com/adobe-webplatform/eve.git
npm ERR! 
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 52.74.223.119]: errno=Connection timed out
npm ERR! 
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-02-27T09_03_17_432Z-debug.log

 

场景:

在用docker 构建vue node项目镜像时,执行npm install 命令是包连接不上github.com

网上搜索到解决方案:

参考:

https://www.daxiblog.com/npm-install%e8%a7%a3%e5%86%b3fatal-unable-to-connect-to-github-com%e9%97%ae%e9%a2%98/

引用上文的解释:

意思是我连接不上github。但是不可能啊,我能够访问github的官网。而且在其他工程里执行npm install都能很顺利执行完成了。看来很有可能是上面截图中eve.git这个库的引用防止有些不太一致造成的。于是在通过在网络上搜寻,找到了原因所在:

上图中可以看到这个eve.git这个库的引用是通过git写引用的。git协议的默认端口是9418,很有可能是我的网络环境防火墙并没有开放这个端口造成的。解决方法就是,用https替代git协议。配置的命令为:

 git config --global url."https://".insteadOf git://

docker 中解决方案:

在Dockerfile中执行npm install之前,执行上述命令

修改如下:

//解决npn install报错连接不上git的问题。
RUN git config --global url."https://".insteadOf git://
RUN npm install

 

后续npm install问题接龙:

1、npm ERR! Failed at the node-sass@4.13.0 postinstall script.

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/erms/uicode/ub-arc-mgmt-gui/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 3.10.0-693.el7.x86_64
gyp ERR! command "/root/.nvm/versions/node/v12.13.1/bin/node" "/home/erms/uicode/ub-arc-mgmt-gui/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/erms/uicode/ub-arc-mgmt-gui/node_modules/node-sass
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN ub-arc-mgmt@4.2.1 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.13.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.13.0 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!     /root/.npm/_logs/2020-03-01T12_04_15_682Z-debug.log

解决:

这个是因为sass安装时获取源的问题,先修改sass安装的源,再运行npm install就成功了

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

 

npm install 报错 fatal: unable to connect to github.com 的解决方法 阅读详情

相关推荐

npm install 报错 Failed to connect to github.com port 443 的解决方法

npm install 报错 Failed to connect to github.com port 443 的解决方法

邓邓子的博客 533

npm安装依赖报fatal: unable to connect to github.com

fatal: unable to connect to github.com; github.com[@: 20.205.243.166]: errno Unknown error; 1s-remote -h -t git://github.com; 1s-remote -h -t ssh://git@github.com; OpenssL SSL read: Connection was reset, errno 1005; Filename too long(文件名称过长)。

weixin_45288512的博客 5099

安装openclaw时出现npm error code 128和npm error An unknown git error occurred报错的解决方案

本文主要介绍了安装openclaw时出现npm error code 128和npm error An unknown git error occurred报错的解决方案,希望能对使用openclaw的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 12万+

npm ERR! fatal: unable to connect to github.com

按顺序执行: 1,删除node_modules 2,删除package-lock.json 3,执行 4,执行 5,执行

u013361179的博客 3767

解决 github项目clone报错 Failed connect to github.com:443; 解决

系统环境:CentOS Linux release 7.6.1810 (Core) 起因:npm构建时报错 npm ERR! Error while executing: npm ERR! /usr/bin/git ls-remote -h -t https://github.com/nhn/raphael.git npm ERR! npm ERR! fatal: unable to access 'https://github.com/nhn/raphael.git/': Failed connect to github.com:443; Connection timed out npm

解决 github项目clone报错 Failed connect to github.com:443; Connection

系统环境:CentOS Linux release 7.6.1810 (Core)  起因:npm构建时报错 npm ERR! Error while executing: npm ERR! /usr/bin/git ls-remote -h -t https://github.com/nhn/raphael.git npm ERR! npm ERR! fatal: unable to access 'https://github.com/nhn/raphael.git/': Failed connect to github.com:443; Connection timed out npm

NPM install 错误 : fatal: unable to connect to github.com 另类安装方法

npm ERR! fatal: unable to connect to github.com: npm ERR! github.com[0: xxxxxx]: errno=No error npm ERR! npm install的时候报错。关于git的 如果这样 通常百度回来都是。。。 $ git config --global url."https://".insteadOf g...

不打代码的程序员 9312

FFmpeg实战:5分钟搞定m3u8视频下载与ts文件合并(附完整命令)

本文详细介绍了如何使用FFmpeg快速下载m3u8视频并合并ts文件为mp4格式。通过简洁的命令行操作,读者可以轻松完成视频处理任务,包括环境准备、链接获取、下载合并及性能优化等实用技巧,特别适合需要高效处理流媒体内容的用户。

weixin_30836759的博客 221

在npm install 时报错 unable to connect to github.com

在npm install 时 unable to connect to github.com 解决办法: 执行 git config --global url.“https://”.insteadOf git:// 再npm install 即可

醉卧雕龙舫,的博客 1837

IP2315高效同步降压充电IC在快充应用中的硬件与软件控制策略

本文深入解析IP2315高效同步降压充电IC在快充应用中的硬件与软件控制策略,涵盖其核心特性、硬件电阻调节技巧、I2C动态控制方案、散热设计优化及典型问题排查。IP2315支持多种快充协议,如Type-C PD、华为FCP等,适用于便携设备快速充电需求,并通过I2C实现灵活的充电参数设置,提升充电效率与安全性。

weixin_29248313的博客 539

1020空心杯电机驱动设计与ESP32实战

空心杯电机是一种高动态响应的直流微特电机,其驱动本质是解决电感负载下的大di/dt启动、反电动势耦合与电流纹波抑制问题。核心原理在于建立包含内阻、电感和反电动势的等效电路模型,并据此匹配开关器件、PWM参数与采样闭环。技术价值体现在小体积下实现毫秒级响应、低噪声(>30kHz)、高精度电流保护(±50mA)及热鲁棒性。典型应用于微型航模、手持云台与精密执行器等对功率密度和动态性能敏感的嵌入式系统。本文以1020规格空心杯电机为对象,基于ESP32平台完成从MOSFET选型、32kHz硬件PWM生成到INA2

weixin_42298164的博客 582

执行npm install 报错 npm ERR! github.com[0: 20.205.243.166]: errno=Unknown error

执行npm install 报错 npm ERR! github.com[0: 20.205.243.166]: errno=Unknown error

m0_38078841的博客 9807

SAP 物料账前期没有运行的解决方法

If you use the actual costing (material ledger), you must have completely closed all period-end closing operations in the actual costing for the penultimate period prior to the period shift. Use the '...

含笑饮砒霜死后更嚣张 3316

【git】npm install报错“git@github.com: Permission denied (publickey)”解决办法

问题描述 直接下载并解压vue-element-admin,并npm install报错 无法生成node_modules文件 解决办法 什么webstorm登陆github账号啊,token啊都没用,还是得用ssh github 与ssh连接 官方文档讲得稍稍复杂(其实也不复杂,照着做会有问题但问题不大) 官方要用gitbash,并且要先检查本地有没有.ssh,我不下那个用gitbash,我这新电脑也没有.ssh,我就直接新建.ssh了。如果你要用gitbash请自行下载gitbash,然后再运行官方文

RogerQianpeng的博客 5383

用C#和MQTTnet在WinForm里做个简易物联网监控后台(附完整源码)

本文详细介绍了如何使用C#和MQTTnet库在WinForm中构建一个简易物联网监控后台。通过实战案例,包括环境配置、MQTT服务端实现、客户端监控功能及高级优化技巧,帮助开发者快速搭建高效的物联网监控系统,适用于工业自动化和智能家居场景。

weixin_29540599的博客 392

Unity游戏开发实战:用柏林噪声打造3D随机地形(附完整C#代码)

本文详细介绍了如何在Unity游戏开发中使用柏林噪声算法生成3D随机地形,包含完整的C#代码实现。从基础柏林噪声原理到高级参数控制,再到性能优化和常见问题解决,帮助开发者掌握程序化地形生成技术,打造丰富多变的游戏世界。

weixin_29281941的博客 101

npm install时出现npm ERR!

文章目录1. 如何使用镜像 npm2. node-sass安装失败3. webpack-dev-server报错npm run dev 报错 今天开始了解学习 Three.js 时,在Github上学习一个Demowebpack-typescript-starter,在vs code中配置环境运行项目时,npm install 出现了问题,有很多 npm ERR!. 可能是你懂得网络的问题,使配...

iqqcode 1万+

Rockchip开发系列 - 3.4.GPIO扩展芯片AW95xx和PCA953X(2)

Rockchip开发系列 - 3.3.GPIO扩展芯片AW95xx和PCA953X(2)

fulinux的博客 1002

npm install 报错:code 128

npm ERR! code 128 npm ERR! An unknown git error occurred PS D:\HT-Code\vue-element-admin> npm install npm ERR! code 128 npm ERR! An unknown git error occurred npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.git npm

Js_Zoro的博客 1万+

开心消消乐

1)当点击一个1时,该1变被反转为0,同时相邻的上、下、左、右,以及左上、左下、右上、右下8个方向的1(如果存在1)均会自动反转为0;2)进一步地,一个位置上的1被反转为0时,与其相邻的8个方向的1(如果存在1)均会自动反转为0;上述样例中,四个角上的1均在中间的1的相邻8个方向上,因此只需要点击一次即可。给定一个N行M列的二维矩阵,矩阵中每个位置的数字取值为0或1。在上述4 * 4的矩阵中,只需要点击2次,即可将所有的1进行消除。接下来N行表示矩阵的初始值,每行均为M个数,取值范围[0,1]

面试高手的博客 2729

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

npm install报错code128

报错内容 npm ERR! Error while executing: npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t git://github.com/adobe-webplatform/eve.git npm ERR! npm ERR! fatal: unable to connect to github.com: npm ERR! github.com[0: 140.82.114.3]: errno=Unknown error np

qq_37291367的博客 1716

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

vue npm install 报错 Unknown SSL protocol error in connection to github.com:443

转自:vue npm install 报错 Unknown SSL protocol error in connection to github.com:443_言之有李LAX的博客-优快云博客 npm ERR! Error while executing: npm ERR! D:\Program Files\Git\cmd\git.EXE ls-remote -h -t https://github.com/nhn/raphael.git npm ERR! npm ERR! fatal: unable

---------- 742

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

vue-element-admin-4.4.0 npm install /usr/bin/git ls-remote 报错 无法连接到 github.com

npm config set registry https://registry.npmmirror.com git config --global url."https://".insteadOf git://

hknaruto的专栏 1120

ML-For-Beginners 的 quiz-app 执行 npm install 失败怎么排查?

ML-For-Beginners 课程仓库中的 `quiz-app/` 目录是一个 Vue.js 应用,承载课程每讲的前置/后置测验(pre- and post-lecture quizzes)。它的标准安装方式就是 `cd quiz-app` 后执行 `npm install`(见 [quiz-app/README.md](https://link.gitcode.com/i/3098d7c8e

gitblog_00153的博客 460

npm 安装包的时候 终端无法连接到 github.com

【代码】npm 安装包的时候 终端无法连接到 github.com。

Aren的博客 1339

npm install报错(非加入密钥方案):unable to connect to github.com

之前一直在网上cpoy各种解决方案,核心原因是协议超时,网上都是各种替换。直接找到c:\用户.gitconfig 这个文件!

qq_40506595的博客 632
上一篇: xshell、xftp无需破解官方免费版获取方式(家庭学校版)
下一篇: easypoi实现表格导出(实现一对多,合并单元格)
grootblockchain
博客等级 码龄11年 55粉丝 101原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值