From bf731193aa306a360d141a62a2805ee5e6ac053a Mon Sep 17 00:00:00 2001 From: LitoMore Date: Sun, 14 Jul 2019 13:37:25 +0800 Subject: [PATCH] Fix install command for npm global (#165) --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7d3f9ab..6a4df7a 100644 --- a/index.js +++ b/index.js @@ -135,10 +135,12 @@ class UpdateNotifier { if (options.isYarnGlobal) { installCommand = `yarn global add ${this.packageName}`; + } else if (options.isGlobal) { + installCommand = `npm i -g ${this.packageName}`; } else if (hasYarn()()) { installCommand = `yarn add ${this.packageName}`; } else { - installCommand = `npm i ${options.isGlobal ? '-g ' : ''}${this.packageName}`; + installCommand = `npm i ${this.packageName}`; } options.message = options.message || 'Update available ' + chalk().dim(this.update.current) + chalk().reset(' → ') +