Repository navigation
ERROR when trying to run ng new when behind a corporate proxy #2685
Description
Please provide us with the following information:
OS?
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 7 enterprise edition
Versions.
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
angular-cli: 1.0.0-beta.16
node: 4.6.0
os: win32 x64
Repro steps.
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
No, I'm trying to create a project using "ng new" and it is unable to clone from github. I've set the http/https proxy settings in the .npmrc and .gitconfig files. I've include authenticate and I've even tried to use CNTLM to manage proxy authentication. It states the proxy is open and does not require another proxy. I am able to access github.com from chrome and IE.
Note: this all works fine when I'm in the office and we can directly connect to github. The only issue is when I telework and I have to go through the proxy. One thing we noticed is the IP address going requesting the files from github is my local IP address and not the proxy. I've set the config file to use the proxy, but it still doesn't work.
The log given by the failure.
Normally this include a stack trace and some more information.
4120 verbose stack Error: Command failed: git -c core.longpaths=true clone --template=C:\Users\peterson_t\AppData\Roaming\npm-cache_git-remotes_templates --mirror git@github.com:webpack/compression-webpack-plugin.git C:\Users\peterson_t\AppData\Roaming\npm-cache_git-remotes\git-github-com-webpack-compression-webpack-plugin-git-7e55907cd54a2e91b96d25a660acc6a2a6453f54-e286d0b5
4120 verbose stack Cloning into bare repository 'C:\Users\peterson_t\AppData\Roaming\npm-cache_git-remotes\git-github-com-webpack-compression-webpack-plugin-git-7e55907cd54a2e91b96d25a660acc6a2a6453f54-e286d0b5'...
4120 verbose stack
4120 verbose stack at ChildProcess.exithandler (child_process.js:213:12)
4120 verbose stack at emitTwo (events.js:87:13)
4120 verbose stack at ChildProcess.emit (events.js:172:7)
4120 verbose stack at maybeClose (internal/child_process.js:829:16)
4120 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
4121 verbose cwd c:\WebstormProjects\AngularTest
4122 error Windows_NT 6.1.7601
4123 error argv "C:\Program Files\nodejs\node.exe" "C:\Users\peterson_t\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install"
4124 error node v4.6.0
4125 error npm v3.10.8
4126 error code 128
4127 error Command failed: git -c core.longpaths=true clone --template=C:\Users\peterson_t\AppData\Roaming\npm-cache_git-remotes_templates --mirror git@github.com:webpack/compression-webpack-plugin.git C:\Users\peterson_t\AppData\Roaming\npm-cache_git-remotes\git-github-com-webpack-compression-webpack-plugin-git-7e55907cd54a2e91b96d25a660acc6a2a6453f54-e286d0b5
4127 error Cloning into bare repository 'C:\Users\peterson_t\AppData\Roaming\npm-cache_git-remotes\git-github-com-webpack-compression-webpack-plugin-git-7e55907cd54a2e91b96d25a660acc6a2a6453f54-e286d0b5'...
4128 error If you need help, you may report this error at:
4128 error <https://github.com/npm/npm/issues
log.txt
4129 verbose exit [ 1, true ]
Mention any other details that might be useful.
Thanks! We'll be in touch soon.
Activity
celliott181 commentedon Oct 13, 2016
This is caused by Line 58 of the package.json, and is caused by an NPM feature.
The line in question:
"compression-webpack-plugin": "github:webpack/compression-webpack-plugin#7e55907cd54a2e91b96d25a660acc6a2a6453f54"NPM is doing exactly what it's expected to, but hasn't considered your environment (It's attempting to use a protocol not allowed by your proxy, I'd assume). This may work as a replacement for you:
"compression-webpack-plugin": "git+https://github.com/webpack/compression-webpack-plugin#7e55907cd54a2e91b96d25a660acc6a2a6453f54"tpeter29 commentedon Oct 13, 2016
I'm not sure that is the only issue. I now get a network tunnel error.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\peterson_t\AppD
ata\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v4.6.0
npm ERR! npm v3.10.8
npm ERR! code ECONNRESET
npm ERR! network tunneling socket could not be established, statusCode=400
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! Please include the following file with any support request:
npm ERR! c:\WebstormProjects\AngularTest\npm-debug.log
I've setup the config files based on what was stated by others:
.npmrc config file as follows
proxy=http://domain%5Cusername:password@xxx.xx.xx.xxx:xxxx
https-http://domain%5Cusername:password@xxx.xx.xx.xxx:xxxx
registry=https://registry.npmjs.org
strict-ssl=false
note I need to use https for the registry config because I receive a json parse error
.gitconfig file as follows
[credential]
helper = manager
[url "https://"]
insteadOf = git:/
[url "/"]
insteadOf = git@github.com:
[http]
proxy = http://domain%5Cusername:password@xxx.xx.xx.xxx:xxxx
[https]
proxy = http://domain%5Cusername:password@xxx.xx.xx.xxx:xxxx
celliott181 commentedon Oct 13, 2016
Well, your git issue isn't the problem this time. The 400 error points to a config error somewhere. You may need strict-ssl set to true.
I'd also talk to your network team and see if they have any custom rules enabled that might prevent NPM from working (Certificate rules, protocol rules, black/whitelists, etc.). They'll have much more context surrounding your environment than anyone here will.
Meligy commentedon Oct 14, 2016
Have you tried setting
https_proxyandhttps_proxyenvironment variables in Windows? That's how it works for me. Git fun really not Angular-CLI fault.Ensure you can
npm installandgit clonefrom Github to make sure your settings work.chore(build): update compression-webpack-plugin
chore(build): update compression-webpack-plugin (#2709)
chore(build): update compression-webpack-plugin (#2709)
chore(build): update compression-webpack-plugin (angular#2709)
chore(build): update compression-webpack-plugin (angular#2709)
angular-automatic-lock-bot commentedon Sep 6, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
chore(build): update compression-webpack-plugin (angular#2709)