David Ewins
Error library

npm ci | tail reports exit 0 but the build still fails on install

npmConfirmed fix

There is no error message for this one, only the symptom in the title.

Cause

$? after a pipeline is the exit code of the last command (tail), not npm ci. tail almost always exits 0, so a failed install looks like a pass.

Fix

Never trust $? after a pipe. Redirect instead and check the real code:

shell
npm ci --include=dev > /tmp/npmci.log 2>&1; echo "exit: $?"

Or use set -o pipefail in the script.

More npm errors

Search all errors