cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Install using a raw IPv6 address registry, report: getaddrinfo ENOTFOUND

Open kycheng opened this issue 2 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

This issue exists in the latest npm version

  • [X] I am using the latest npm

Current Behavior

I deployed a nexus as npm registry on IPv6 environment. And set it by npm set registry=http://[2004::192:168:129:133]:31666/repository/arm-npm-proxy/

When I run npm install , I have a problem with:

npm verb cli /usr/local/bin/node /usr/local/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verb title npm install
npm verb argv "install" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/root/.npm/_logs/2023-06-13T08_55_11_084Z-
npm verb logfile /root/.npm/_logs/2023-06-13T08_55_11_084Z-debug-0.log
2023-06-13T08:55:11.190Z agentkeepalive sock[0#[2004::192:168:129:133]:31666:] create, timeout 300001ms
2023-06-13T08:55:11.196Z agentkeepalive sock[0#[2004::192:168:129:133]:31666:](requests: 1, finished: 0) error: Error: getaddrinfo ENOTFOUND [2004::192:168:129:133]
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: '[2004::192:168:129:133]'
}, listenerCount: 2
2023-06-13T08:55:11.201Z agentkeepalive sock[0#[2004::192:168:129:133]:31666:](requests: 1, finished: 0) close, isError: true

It seems that IPv6 addresses are treated as domain names.

Expected Behavior

correct installation

Steps To Reproduce

  1. Install an IPv6 registry
  2. set registry
  3. Run 'npm install --verbose'
  4. getaddrinfo ENOTFOUND

Environment

  • npm: 9.5.1
  • Node.js: v18.16.0
  • OS Name: Linux
  • System Model Name: x86_64
  • npm config:
; "user" config from /root/.npmrc

//[2004::192:168:129:133]:31666/repository/arm-npm-proxy/:_password = (protected)
//[2004::192:168:129:133]:31666/repository/arm-npm-proxy/:username = "admin"
audit = false
registry = "http://[2004::192:168:129:133]:31666/repository/arm-npm-proxy/"

; node bin location = /usr/local/bin/node
; node version = v18.16.0
; npm local prefix = /workspace/source
; npm version = 9.5.1
; cwd = /workspace/source
; HOME = /root
; Run `npm config ls -l` to show all defaults.

kycheng avatar Jun 13 '23 09:06 kycheng

I deployed nexus in the same environment using a domain name, and it can be installed correctly as a registry.

I found some discussions about IPv6, but it seems to be related to IPv6 domains (https://github.com/npm/cli/issues/2519), or some network related issues (with proxy configured), and What I'm encountering doesn't seem to be a problem.

kycheng avatar Jun 13 '23 09:06 kycheng

Has anyone else run into a similar problem?

kycheng avatar Aug 30 '23 07:08 kycheng

I tested the latest version and still have this problem:

image

yarn works fine: image

kycheng avatar Sep 13 '23 09:09 kycheng