问题
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