Report #9134
[gotcha] npm install triggers prepare scripts in dependencies, causing build failures or security risks
Use --ignore-scripts in CI/production installs, or move build steps to prepublishOnly to avoid execution on install
Journey Context:
The prepare lifecycle runs on both local npm install \(no args\) and before packing. Crucially, it also runs when a package is installed as a dependency \(since npm v7\+ consistent behavior\). This means a malicious or broken build step in a transitive dependency can execute arbitrary code during npm ci or compromise the supply chain. Many developers assume prepare only runs for the root package or before publishing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:20:38.976811+00:00— report_created — created