Skip to content

npm install failed with NodeJS 16 or later on https over http proxy #3214

Description

Sorry if this report is dupllicated, but I can't find similar one.

npm install -g azure-functions-core-tools@4 is failed with NodeJS 18 LTS on http proxy as follows:

$ node --version
v18.12.1
$ npm install -g azure-functions-core-tools@4
npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm ERR! code 1
npm ERR! path /home/xxxxx/.anyenv/envs/nodenv/versions/18.12.1/lib/node_modules/azure-functions-core-tools
npm ERR! command failed
npm ERR! command sh -c -- node lib/install.js
npm ERR! attempting to GET "https://functionscdn.azureedge.net/public/4.0.4895/Azure.Functions.Cli.linux-x64.4.0.4895.zip"
npm ERR! using proxy server "http://xxxx.xxxx.jp:8080"
npm ERR! node:_http_client:186
npm ERR!     throw new ERR_INVALID_PROTOCOL(protocol, expectedProtocol);
npm ERR!     ^
npm ERR!
npm ERR! TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
npm ERR!     at new NodeError (node:internal/errors:393:5)
npm ERR!     at new ClientRequest (node:_http_client:186:11)
npm ERR!     at request (node:https:360:10)
npm ERR!     at Object.get (node:https:394:15)
npm ERR!     at Object.<anonymous> (/home/xxxx/.anyenv/envs/nodenv/versions/18.12.1/lib/node_modules/azure-functions-core-tools/lib/install.js:69:7)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1159:14)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1037:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:878:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:23:47 {
npm ERR!   code: 'ERR_INVALID_PROTOCOL'
npm ERR! }
npm ERR!
npm ERR! Node.js v18.12.1

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xxxxx/.npm/_logs/2022-12-02T07_30_32_880Z-debug-0.log

To fix this error, it may be necessary to update the agent-base dependency version from 6.0.0 to 6.0.2.

Because 'NodeJS 15 changed new Error().stack representation' and agent-base 6.0.2 fixes it.
See:

Note: So, I troubled with NodeJS 18, but issue's title is 'NodeJS 16 or later'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions