npm does not work behind corporate proxy and launched from apm

╄→尐↘猪︶ㄣ 提交于 2019-12-25 07:45:03

问题


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

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 content

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

.gitconfig content

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

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

Anything I missed?


回答1:


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.

Cheers, Yann



来源:https://stackoverflow.com/questions/43493671/npm-does-not-work-behind-corporate-proxy-and-launched-from-apm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!