Home·Error messages

buildkit · Docker

The message

failed to solve: process "/bin/sh -c npm ci" did not complete successfully: exit code: 1

What it means

That RUN line in your Dockerfile exited with a non-zero status. All this line carries is which command failed and with what code; the actual reason is in that command's own output above, which BuildKit tends to fold away once a step finishes. Re-running with docker build --progress=plain prints every step's output in full, and if a cached layer is hiding an older failure, add --no-cache — at the price of rebuilding everything from the first step. exit code: 1 is not a reason, only the fact that the command failed.

The fix

docker build --progress=plain --no-cache .
Printed by
buildkit
Docker
12

Docker errors only become readable once you place them in a layer — the client failing to reach the daemon, the registry refusing you, a RUN failing during the build, and a container dying the instant it starts are four different problems — and for the build and run layers the line itself is not the reason: the reason is in the output of the command that was running inside, while the cost of each fix differs by layer too.

Reading an error message

  • Read from the first line down. The lower you go the more it is about the tool’s internals; the cause is usually at the top.
  • If there is a file and a line number, start there — not the top stack frame, but the topmost line that names a file you wrote.
  • Search the message verbatim, but strip your own paths and variable names first; those are what stop the search from matching.
  • The same condition is worded differently across tool versions. If results look wrong, add the version number to the query.
  • Before pasting a fix, check what it throws away. Some of these cannot be undone.

Common questions

Q. What does “failed to solve: process "/bin/sh -c npm ci" did not complete successfully: exit code: 1” mean?

That RUN line in your Dockerfile exited with a non-zero status. All this line carries is which command failed and with what code; the actual reason is in that command's own output above, which BuildKit tends to fold away once a step finishes. Re-running with docker build --progress=plain prints every step's output in full, and if a cached layer is hiding an older failure, add --no-cache — at the price of rebuilding everything from the first step. exit code: 1 is not a reason, only the fact that the command failed.

Q. How do I fix it?

docker build --progress=plain --no-cache . — before running it, check the explanation above for what this command discards.

Q. Which tool prints this?

buildkit. It sits under Docker, and the message runs to 15 words.

Errors nearby