diff --git a/lib/commands/install.js b/lib/commands/install.js index 24e5f6819b314..383de12174e4f 100644 --- a/lib/commands/install.js +++ b/lib/commands/install.js @@ -97,10 +97,9 @@ class Install extends ArboristWorkspaceCmd { async exec (args) { // the /path/to/node_modules/.. - const globalTop = resolve(this.npm.globalDir, '..') const ignoreScripts = this.npm.config.get('ignore-scripts') const isGlobalInstall = this.npm.global - const where = isGlobalInstall ? globalTop : this.npm.prefix + const where = this.npm.prefix const forced = this.npm.config.get('force') const scriptShell = this.npm.config.get('script-shell') || undefined @@ -128,13 +127,13 @@ class Install extends ArboristWorkspaceCmd { args = args.filter(a => resolve(a) !== this.npm.prefix) // `npm i -g` => "install this package globally" - if (where === globalTop && !args.length) { + if (isGlobalInstall && !args.length) { args = ['.'] } // throw usage error if trying to install empty package // name to global space, e.g: `npm i -g ""` - if (where === globalTop && !args.every(Boolean)) { + if (isGlobalInstall && !args.every(Boolean)) { throw this.usageError() }