Skip to content

Commit

Permalink
Merge pull request #62 from golemfactory/bugfix/JST-498/better-error-…
Browse files Browse the repository at this point in the history
…reporting-on-dependency-installation-errors

fix: report error if dependency installation fails
  • Loading branch information
pgrzy-golem authored Oct 18, 2023
2 parents c0acf44 + 2dafc6b commit 838954e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/new/new.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,16 @@ function installDependencies(options: NewOptions, projectPath: string) {
console.log("Installing dependencies...");

const pkg = getPackageManager();
const oldWd = process.cwd();
const args = pkg.name === "yarn" ? [] : ["install"];

process.chdir(projectPath);
const result = spawnSync(pkg.name, args, { stdio: "inherit" });
process.chdir(oldWd);
const result = spawnSync(pkg.name, args, { cwd: projectPath, stdio: "inherit" });

if (result.error) {
console.error("Error: There was a problem installing dependencies. You may need to install them manually.");
console.error(`Error: There was a problem installing dependencies: ${result.error.message}`);
console.error("Note: You may need to install dependencies manually.");
} else if (result.status !== 0) {
console.error(`Error: Process existed with status code ${result.status}.`);
console.error("Note: You may need to install dependencies manually.");
}
}

Expand Down

0 comments on commit 838954e

Please sign in to comment.