From d8114618137bb5b9a52a86711bb8dc18bfc8e60c Mon Sep 17 00:00:00 2001 From: Brian Olore Date: Fri, 3 Aug 2018 12:21:58 -0400 Subject: [PATCH] cli: don't check for updates to npm when we are updating npm itself (#32) PR-URL: https://github.com/npm/cli/pull/32 Credit: @olore Reviewed-By: @zkat --- bin/npm-cli.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/npm-cli.js b/bin/npm-cli.js index a38009d276e3..e4da63c9795d 100755 --- a/bin/npm-cli.js +++ b/bin/npm-cli.js @@ -69,12 +69,15 @@ npm.command = 'help' } + var isGlobalNpmUpdate = conf.global && ['install', 'update'].includes(npm.command) && npm.argv.includes('npm') + // now actually fire up npm and run the command. // this is how to use npm programmatically: conf._exit = true npm.load(conf, function (er) { if (er) return errorHandler(er) if ( + !isGlobalNpmUpdate && npm.config.get('update-notifier') && !unsupported.checkVersion(process.version).unsupported ) {