diff --git a/lib/install.js b/lib/install.js index 617dd8663..84b0e9591 100644 --- a/lib/install.js +++ b/lib/install.js @@ -56,8 +56,8 @@ function place_binary(uri, targetDir, opts, callback) { process.env.npm_config_proxy; let agent; if (proxyUrl) { - const ProxyAgent = require('https-proxy-agent'); - agent = new ProxyAgent(proxyUrl); + const { HttpsProxyAgent } = require('https-proxy-agent'); + agent = new HttpsProxyAgent(proxyUrl); log.http('download', 'proxy agent configured using: "%s"', proxyUrl); } diff --git a/package-lock.json b/package-lock.json index de1615f74..94ae794b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "BSD-3-Clause", "dependencies": { "detect-libc": "^2.0.0", - "https-proxy-agent": "^5.0.0", + "https-proxy-agent": "^7.0.5", "make-dir": "^3.1.0", "node-fetch": "^2.6.7", "nopt": "^7.2.1", @@ -1256,6 +1256,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, "license": "MIT", "dependencies": { "debug": "4" @@ -3364,16 +3365,28 @@ } }, "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "license": "MIT", "dependencies": { - "agent-base": "6", + "agent-base": "^7.0.2", "debug": "4" }, "engines": { - "node": ">= 6" + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent/node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" } }, "node_modules/ieee754": { @@ -5882,6 +5895,20 @@ "node": ">=10" } }, + "node_modules/teeny-request/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", diff --git a/package.json b/package.json index 6d5d1a987..95199c18c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "detect-libc": "^2.0.0", - "https-proxy-agent": "^5.0.0", + "https-proxy-agent": "^7.0.5", "make-dir": "^3.1.0", "node-fetch": "^2.6.7", "nopt": "^7.2.1", diff --git a/test/proxy-bcrypt.test.js b/test/proxy-bcrypt.test.js index b13818ed0..72c43c4aa 100644 --- a/test/proxy-bcrypt.test.js +++ b/test/proxy-bcrypt.test.js @@ -6,7 +6,7 @@ const { createUnzip } = require('zlib'); const os = require('os'); const tar = require('tar-fs'); -const Agent = require('https-proxy-agent'); +const { HttpsProxyAgent } = require('https-proxy-agent'); const fetch = require('node-fetch'); const { rimraf } = require('rimraf'); @@ -44,7 +44,7 @@ test('setup proxy server', (t) => { proxy.startServer({ port: proxyPort }); process.env.https_proxy = process.env.http_proxy = proxyServer; - options.agent = new Agent(proxyServer); + options.agent = new HttpsProxyAgent(proxyServer); // make sure the download directory deleted then create an empty one rimraf(downloadDir).then(() => {