diff --git a/packages/@angular/cli/bin/ng b/packages/@angular/cli/bin/ng index 85d52dfbc60e..dfd042cb0872 100755 --- a/packages/@angular/cli/bin/ng +++ b/packages/@angular/cli/bin/ng @@ -155,13 +155,21 @@ resolve('@angular/cli', { basedir: process.cwd() }, } if (shouldWarn && CliConfig.fromGlobal().get('warnings.versionMismatch')) { - // eslint-disable no-console - console.log(yellow(stripIndents` - Your global Angular CLI version (${globalVersion}) is greater than your local - version (${localVersion}). The local Angular CLI version is used. - - To disable this warning use "ng set --global warnings.versionMismatch=false". - `)); + let warning = yellow(stripIndents` + Your global Angular CLI version (${globalVersion}) is greater than your local + version (${localVersion}). The local Angular CLI version is used. + + To disable this warning use "ng set --global warnings.versionMismatch=false". + `); + // Don't show warning colorised on `ng completion` + if (process.argv[2] !== 'completion') { + // eslint-disable no-console + console.log(warning); + } else { + // eslint-disable no-console + console.error(warning); + process.exit(1); + } } // No error implies a projectLocalCli, which will load whatever