npm fails to install on IPv6 only networks

[note: the forum does not let me post it correctly, as the post is limited to 5 urls - I have modified the URL output below so that I can post here]
[modifications:

URL1=registry.npmjs.org
IP1=104.16.21.35

What I Wanted to Do

Install node-red using npm install node-red

What Happened Instead

An “ENETUNREACH 104.16.21.35:443” error occured

Reproduction Steps

Important: the IPv6 only host CAN reach URL1 via NAT64 - a connection is possible, if npm was using IPv6.

Details

nodejshost:~$ npm install node-red
npm ERR! code ENETUNREACH
npm ERR! errno ENETUNREACH
npm ERR! request to URL1/node-red failed, reason: connect ENETUNREACH IP1:443 - Local (0.0.0.0:0)

npm ERR! A complete log of this run can be found in:
npm ERR! /home/app/.npm/_logs/2019-08-16T08_41_18_332Z-debug.log

Logfile:

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/bin/node’, ‘/usr/bin/npm’, ‘install’, ‘node-red’ ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose config Skipping project config: /home/app/.npmrc. (matches userconfig)
5 verbose npm-session 958a6ab568040871
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 silly fetchPackageMetaData error for nodered@latest request to [URL]registry.npmjs.org/node-red failed, reason: connect ENE
TUNREACH :443 - Local (0.0.0.0:0)
9 timing stage:rollbackFailedOptional Completed in 2ms
10 timing stage:runTopLevelLifecycles Completed in 242ms
11 verbose type system
12 verbose stack FetchError: request to URL1/nodered failed, reason: connect ENETUNREACH IP1:443

  • Local (0.0.0.0:0)
    12 verbose stack at ClientRequest.req.on.err (/usr/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
    12 verbose stack at ClientRequest.emit (events.js:198:13)
    12 verbose stack at TLSSocket.socketErrorListener (_http_client.js:392:9)
    12 verbose stack at TLSSocket.emit (events.js:198:13)
    12 verbose stack at emitErrorNT (internal/streams/destroy.js:91:8)
    12 verbose stack at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    12 verbose stack at process._tickCallback (internal/process/next_tick.js:63:19)
    13 verbose cwd /home/app
    14 verbose Linux 4.19.41-0-virt
    15 verbose argv “/usr/bin/node” “/usr/bin/npm” “install” “node-red”
    16 verbose node v10.16.0
    17 verbose npm v6.9.0
    18 error code ENETUNREACH
    19 error errno ENETUNREACH
    20 error request to https://registry.npmjs.org/nodered failed, reason: connect ENETUNREACH IP1:443 - Local (0.0.0.0:0)

21 verbose exit [ 1, true ]

registry is actually reachable:

nodejshost:~$ curl -I URL1/node-red
HTTP/2 200 
date: Fri, 16 Aug 2019 14:38:47 GMT
content-type: application/json
content-length: 233097
set-cookie: __cfduid=da55720ceef5a3cb2c12da328d8b8706b1565966327; expires=Sat, 15-Aug-20 14:38:47 GMT; path=/; domain=.npmjs.org; HttpOnly
cf-cache-status: HIT
cache-control: max-age=300
cf-ray: 5074276978633eae-ZRH
accept-ranges: bytes
age: 4848
etag: "c4fd5e736f7ec287d9f0a0c5c266dc29"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
last-modified: Fri, 05 Jul 2019 10:48:30 GMT
vary: accept-encoding, accept
x-amz-meta-rev: 174-d2d2e19e1a41a37db439ea4aae471997
server: cloudflare

nodejshost:~$ 

Platform Info

$ npm --versions
nodejshost:~$ npm --versions
{ npm: '6.9.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.9.2',
  icu: '64.2',
  modules: '64',
  napi: '4',
  nghttp2: '1.34.0',
  node: '10.16.0',
  openssl: '1.1.1c',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.29.1',
  v8: '6.8.275.32-node.52',
  zlib: '1.2.11' }
nodejshost:~$ 

$ node -p process.platform
linux

I can confirm that this is still an issue. I am using an IPv6 only host on vultr and have confirmed all of the above mentioned by nicoschottelius is accurate, including that the registry is still reachable by curl, but not npm install.

Is there a workaround for now?

I found a workaround that forces the resolution of registry.npmjs.org to the IPv6 address by appending:

2606:4700::6810:1723 registry.npmjs.org

to the /etc/hosts file in linux.