Skip to content

Commit

Permalink
Merge pull request #8467 from rwjblue/fix-npm-version-check
Browse files Browse the repository at this point in the history
Ensure npm version is available during ember new / ember install foo.
  • Loading branch information
Turbo87 committed Feb 28, 2019
2 parents c85d8ae + a01144c commit 03bed0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/tasks/npm-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class NpmTask extends Task {
'verified to work with the current Ember CLI release.');
}

return { npmVersion: version };
}).catch(error => {
logger.error('npm --version failed: %s', error);

Expand Down Expand Up @@ -137,7 +138,7 @@ class NpmTask extends Task {
run(options) {
this.useYarn = options.useYarn;

return this.findPackageManager().then(() => {
return this.findPackageManager().then(result => {
let ui = this.ui;
let startMessage = this.formatStartMessage(options.packages);
let completeMessage = this.formatCompleteMessage(options.packages);
Expand All @@ -162,7 +163,7 @@ class NpmTask extends Task {
// this ensures that we run a full `npm install` **after** any `npm
// install foo` runs to ensure that we have a fully functional
// node_modules heirarchy
if (semver.gte(this.npmVersion, '5.0.0')) {
if (result.npmVersion && semver.gte(result.npmVersion, '5.0.0')) {
promise = promise.then(() => this.npm(['install']));
}
}
Expand Down

0 comments on commit 03bed0c

Please sign in to comment.