Skip to content

Commit 48c343b

Browse files
committed
Output error when command fails
1 parent b52f311 commit 48c343b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/react-scripts/scripts/eject.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ function adjustPackages(cwd, packages, append, dev) {
4545
if (!Array.isArray(packages)) {
4646
packages = [packages];
4747
}
48-
let status;
48+
let status, output;
4949
if (fs.existsSync(paths.yarnLockFile)) {
50-
({ status } = spawnSync(
51-
'yarnpkg',
50+
({ status, output } = spawnSync(
51+
process.platform === 'win32' ? 'yarnpkg.cmd' : 'yarnpkg',
5252
[append ? 'add' : 'remove', ...packages],
5353
{
5454
stdio: 'pipe',
5555
cwd,
5656
}
5757
));
5858
} else {
59-
({ status } = spawnSync(
59+
({ status, output } = spawnSync(
6060
'npm',
6161
[
6262
append ? 'install' : 'uninstall',
@@ -74,7 +74,8 @@ function adjustPackages(cwd, packages, append, dev) {
7474

7575
if (status !== 0) {
7676
console.error(chalk.red('Failed to update the dependencies.'));
77-
77+
console.error();
78+
console.error(output.join(process.platform === 'win32' ? '\r\n' : '\n'));
7879
process.exit(status);
7980
}
8081
}

0 commit comments

Comments
 (0)