yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Error message "error Command failed with exit code 1" is missing vital information -- what command failed?

Open atsalolikhin-spokeo opened this issue 4 years ago • 3 comments

Bug description

I am helping to debug a CI build which is failing with the following output:

error Command failed with exit code 1
error Command failed with exit code 1

It prints the error message twice. We can't tell which command failed. The command is missing from the error message. It would be nice if the error message included the command so that we could see what's happening and fix it.

Command

yarn run webpack:verify

What is the current behavior?

Yarn prints the error message

error Command failed with exit code 1

What is the expected behavior?

It would be nice to have completed information, e.g. (made up example):

error Command "/bin/rm /tmp/nosuchfile" failed with exit code 1

Or, even better, show any stdout/stderr from the command:

error Command "/bin/rm /tmp/nosuchfile" failed with exit code 1: "rm: /tmp/nosuchfile: No such file or directory"

Steps to Reproduce

Environment

  • Node Version: v8.16.2
  • Yarn v1 Version: 1.19.2
  • OS and version: Amazon Linux 2

atsalolikhin-spokeo avatar Oct 22 '20 17:10 atsalolikhin-spokeo

I found this error message here:

https://github.com/yarnpkg/yarn/blob/a4708b29ac74df97bac45365cba4f1d62537ceb7/tests/integration.js#L451

I am not sure how it relates to the section where the error repot is made:

https://github.com/yarnpkg/yarn/blob/a3b1294c22043cd8868b6a1decb77b673e764efd/src/util/execute-lifecycle-script.js#L363

atsalolikhin-spokeo avatar Oct 22 '20 22:10 atsalolikhin-spokeo

我在这里发现了这个错误信息:

https://github.com/yarnpkg/yarn/blob/a4708b29ac74df97bac45365cba4f1d62537ceb7/tests/integration.js#L451

我不确定它与生成错误报告的部分有何关系:

https://github.com/yarnpkg/yarn/blob/a3b1294c22043cd8868b6a1decb77b673e764efd/src/util/execute-lifecycle-script.js#L363

Hi, I am in the same trouble just like you, have you resolve this problem?

theChengundertheQun avatar Jun 27 '22 03:06 theChengundertheQun

We did, but I don't remember how... Sorry!

atsalolikhin-spokeo avatar Jun 27 '22 17:06 atsalolikhin-spokeo