diff --git a/lib/cli.js b/lib/cli.js index fdca486..d9c694d 100755 --- a/lib/cli.js +++ b/lib/cli.js @@ -3,4 +3,12 @@ require('.')(); // Override http networking to go through a proxy if one is configured. -require('global-tunnel-ng').initialize(); +const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10); + +if (MAJOR_NODEJS_VERSION >= 10) { + // `global-agent` works with Node.js v10 and above. + require('global-agent').bootstrap(); +} else { + // `global-tunnel-ng` works only with Node.js v10 and below. + require('global-tunnel-ng').initialize(); +} diff --git a/package.json b/package.json index c5b7a93..5133613 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "ansi-styles": "^3.2.0", "bin-version-check": "^3.0.0", "chalk": "^2.3.0", + "global-agent": "^2.0.0", "global-tunnel-ng": "^2.5.3", "latest-version": "^3.1.0", "log-symbols": "^2.1.0",