npm无法在企业代理后面工作,而是从apm启动 [英] npm does not work behind corporate proxy and launched from apm

查看:92
本文介绍了npm无法在企业代理后面工作,而是从apm启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代理后面遇到npm的问题.

I'm having an issue with npm behind a proxy.

npm install失败是因为npm从apm启动时无法进行git clone,这很奇怪,因为apm中的同一命令行可以正常工作.

npm install fails because npm can not git clone when launched from apm, which is weird because same command line out of apm works.

npm ERR! Command failed: git -c core.longpaths=true fetch -a origin
npm ERR! fatal: Unable to look up github.com (port 9418) (Unknown host.)

.npmrc内容

proxy=http://proxy-xxx:8080
http-proxy=http://proxy-xxx:8080
https-proxy=http://proxy-xxx:8080

.gitconfig内容

.gitconfig content

[url "https://"]
    insteadOf = git://
[url "https://github.com/"]
    insteadOf = git@github.com:
[http]
    proxy = proxy-xxx:8080

它似乎来自git URL,这很奇怪,因为手动启动时,该命令可以工作.

Seems it comes from git URL, which is weird because same command works when launched manually.

我错过了什么吗?

推荐答案

在插件安装过程中,HOME环境已设置为%USERPROFILE%\.atom\.node-gyp.它明显不同于通常的git执行. 因此,我通过在其中放置描述HTTPS代理设置和架构替换规则的.gitconfig来绕过该问题.

HOME environment has been set to %USERPROFILE%\.atom\.node-gyp during plugin installation. It differs obviously from usual git execution. So, I bypassed the problem by putting .gitconfig there which describes HTTPS proxy setting and schema-replacement rule.

干杯, 扬(Nann)

Cheers, Yann

这篇关于npm无法在企业代理后面工作,而是从apm启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆