pnpm "ELIFECYCLE prepare failed" in CI
A package ran its prepare script during pnpm install and that script exited non-zero. prepare runs for git dependencies and on local pack, so a build tool missing there fails the whole install.
What this error means
Install fails with ELIFECYCLE and "prepare: Exit status 1" for a specific package, usually a git or local dependency whose prepare runs a build that needs devDependencies.
ELIFECYCLE Command failed with exit code 1.
.../node_modules/.../my-dep prepare: `tsc -p .`
.../node_modules/.../my-dep prepare: Exit status 1Common causes
prepare needs missing devDependencies
The prepare script builds the package but its build tools are not installed in the CI context, so the script fails.
A git dependency builds on install
A git: or github: dependency triggers prepare to compile sources at install time, and that build broke.
How to fix it
Make prepare self-sufficient
Ensure the prepare script only uses tools the dependency declares, so it can build wherever it is installed.
- Run the failing prepare command locally to see the real error.
- Add any build tool the script needs to that package devDependencies.
- Prefer publishing a built package over a git dependency that builds on install.
Pin a published version instead of a git ref
Depend on a released version so no prepare build runs during install.
pnpm add my-dep@1.4.0How to prevent it
- Avoid git dependencies that build via prepare in CI.
- Keep prepare scripts self-contained with declared build tools.
- Prefer published, prebuilt packages over install-time builds.