[BUG] npm install fails to resolve proxy server address
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Current Behavior:
In npm 6, npm install works behind a proxy when the http_proxy and https_proxy environment variables are set.
npm 7 fails with:
#9 [5/5] RUN npm install
#9 6.650 npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
#9 11.04 npm ERR! code ENOTFOUND
#9 11.04 npm ERR! syscall getaddrinfo
#9 11.04 npm ERR! errno ENOTFOUND
#9 11.04 npm ERR! network request to https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz failed, reason: getaddrinfo ENOTFOUND xxx.proxy.corp.com
#9 11.04 npm ERR! network This is a problem related to network connectivity.
#9 11.04 npm ERR! network In most cases you are behind a proxy or have bad network settings.
#9 11.04 npm ERR! network
#9 11.04 npm ERR! network If you are behind a proxy, please make sure that the
#9 11.05 npm ERR! network 'proxy' config is set properly. See: 'npm help config'
#9 11.06
#9 11.06 npm ERR! A complete log of this run can be found in:
#9 11.06 npm ERR! /root/.npm/_logs/2021-01-20T23_07_32_036Z-debug.log
#9 ERROR: executor failed running [/bin/sh -c npm install]: runc did not terminate sucessfully
If I replace the proxy DNS name with its IP address, it works fine, so it seems to be a bug in proxy DNS name resolution.
Expected Behavior:
It works fine in npm 6 using the proxy DNS name (no IP address required):
#8 [4/4] RUN npm install
#8 5.827 npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
#8 15.08
#8 15.08 > core-js@2.6.12 postinstall /usr/src/app/node_modules/core-js
#8 15.08 > node -e "try{require('./postinstall')}catch(e){}"
#8 15.08
#8 15.13 Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
#8 15.13
#8 15.13 The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
#8 15.13 > https://opencollective.com/core-js
#8 15.13 > https://www.patreon.com/zloirock
#8 15.13
#8 15.13 Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
#8 15.13
#8 15.25 npm notice created a lockfile as package-lock.json. You should commit this file.
#8 15.26 added 134 packages from 82 contributors and audited 135 packages in 14.626s
#8 15.32
#8 15.32 2 packages are looking for funding
#8 15.32 run `npm fund` for details
#8 15.32
#8 15.32 found 0 vulnerabilities
#8 15.32
#8 DONE 15.5s
Environment:
- OS: node:lts-alpine and node:current-alpine in Docker 19.03.13
- npm: 6.14.10 and 7.4.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing npm 7.4.2 versus npm 6.14.10 in the listed node Alpine Docker environments with proxy hostnames supplied through http_proxy and https_proxy. Trace the npm install network request that produces ENOTFOUND and compare its proxy resolution with the working IP-address case; done means npm 7 resolves the proxy hostname without requiring an IP address.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, javascript, nodejs
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100