From 4fc82802059fe76b55f2fd6d7afdcfb32bfac2dc Mon Sep 17 00:00:00 2001 From: LitoMore Date: Sun, 14 Jul 2019 11:57:42 +0800 Subject: [PATCH] Fix install command for npm global --- 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(' → ') +