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

> $? 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.

Web page: https://davidewins.com/errors/pipe-exit-code-hides-npm-ci-failure

npm. Confirmed fix, 1 September 2026.

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:
```bash
npm ci --include=dev > /tmp/npmci.log 2>&1; echo "exit: $?"
```
Or use `set -o pipefail` in the script.

## More npm errors

- [EAS build fails at Install dependencies: Missing package from lock file](https://davidewins.com/errors/eas-npm-ci-missing-from-lock-file)
- [EAS Install dependencies fails after adding a video SDK: deduped package below its peer range](https://davidewins.com/errors/eas-npm-ci-nested-peer-url-polyfill)
- [`npx -y typescript@x tsc --noEmit` prints no TS errors but did not typecheck at all](https://davidewins.com/errors/npx-typescript-could-not-determine-executable)

[Search all errors](https://davidewins.com/errors)
