Skip to content

Commit

Permalink
Merge pull request strapi#4389 from strapi/chore/improve-install-dep-…
Browse files Browse the repository at this point in the history
…error-message

Improve the error message on install dependencies error
  • Loading branch information
alexandrebodin authored Oct 29, 2019
2 parents 062c1c8 + 81d2350 commit 6b57d15
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
21 changes: 20 additions & 1 deletion packages/strapi-generate-new/lib/create-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,26 @@ module.exports = async function createProject(

await captureStderr('didNotInstallProjectDependencies', error);

stopProcess('Stopping installation');
console.log(chalk.black.bgWhite(' Keep trying! '));
console.log();
console.log(
chalk.bold(
'Oh, it seems that you encountered errors while installing dependencies in your project.'
)
);
console.log(`Don't give up, your project was created correctly.`);
console.log(
`Fix the issues mentionned in the installation errors and try to run the following command:`
);
console.log();
console.log(
`cd ${chalk.green(rootPath)} && ${chalk.cyan(
scope.useYarn ? 'yarn' : 'npm'
)} install`
);
console.log();

stopProcess();
}

await trackUsage({ event: 'didCreateProject', scope });
Expand Down
2 changes: 1 addition & 1 deletion packages/strapi-generate-new/lib/utils/stop-process.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

module.exports = function stopProcess(message) {
console.error(message);
if (message) console.error(message);
process.exit(1);
};
1 change: 1 addition & 0 deletions packages/strapi-generate-new/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"dependencies": {
"@sentry/node": "^5.7.1",
"chalk": "^2.4.2",
"execa": "^1.0.0",
"fs-extra": "^8.0.1",
"inquirer": "^6.3.1",
Expand Down

0 comments on commit 6b57d15

Please sign in to comment.