Cli: [BUG] Protocol "https:" not supported. Expected "http:"

Created on 21 Oct 2020  路  4Comments  路  Source: npm/cli

Upgraded from node 14 to node 15.0.0
Upgraded npm to 7.0.3

Current Behavior:

Running the command
npm install -g npm-check-updates
I get the following that doesn't happened in v6.14
image

The error log is:

 TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
    at new NodeError (node:internal/errors:258:15)
    at new ClientRequest (node:_http_client:155:11)
    at request (node:https:313:10)
    at C:\Users\<USER>\AppData\Roaming\npm\node_modules\npm\node_modules\minipass-fetch\lib\index.js:80:17
    at new Promise (<anonymous>)
    at fetch (C:\Users\<USER>\AppData\Roaming\npm\node_modules\npm\node_modules\minipass-fetch\lib\index.js:39:10)
    at C:\Users\<USER>\AppData\Roaming\npm\node_modules\npm\node_modules\make-fetch-happen\index.js:297:14
    at C:\Users\<USER>\AppData\Roaming\npm\node_modules\npm\node_modules\promise-retry\index.js:29:24

My npm config doesn't change too:

proxy=http://my.proxycompany.com:80/
http-proxy=http://my.proxycompany.com:80
https-proxy=http://my.proxycompany.com:80/
registry=https://registry.npmjs.org/
strict-ssl=false

EDIT
Changing registry to http it works, but I don't know why.
registry=http://registry.npmjs.org/

Expected Behavior:

Run npm install and install the library successfully.

Environment:

  • OS: Windows 10 v1909
  • Node: 15.0.0
  • npm: 7.0.3
Bug Release 7.x

Most helpful comment

I got the same error in my macOS with the same node/npm version.

I've fixed this error by unset all the proxy environment:

unset http_proxy; unset https_proxy; unset all_proxy;

You can run npm install correctly after that.

All 4 comments

This PR might help:
https://github.com/TooTallNate/node-agent-base/pull/47
fix ERR_INVALID_PROTOCOL in NodeJS 15 when connect https url through http proxy

Using HTTPS_PROXY as a workaround for https://github.com/npm/cli/issues/2060 does not work because of this second bug, outstanding.

I got the same error in my macOS with the same node/npm version.

I've fixed this error by unset all the proxy environment:

unset http_proxy; unset https_proxy; unset all_proxy;

You can run npm install correctly after that.

updating npm to anything newer than 7.0.6 should correct this as that's when we brought in the updated agent-base dependency

Was this page helpful?
0 / 5 - 0 ratings