Report #77056
[gotcha] npm prepare lifecycle script executes during git dependency installation
Move build steps requiring devDependencies to prepublishOnly instead of prepare, or guard prepare with environment checks \(e.g., $npm\_config\_production\) to skip builds during consumer installs.
Journey Context:
Developers use prepare to build assets before publishing. However, npm runs prepare when installing git dependencies \(e.g., npm install user/repo\), executing on the end-user's machine which lacks typescript or babel. This causes 'command not found' errors on consumer machines. prepublishOnly only runs before npm publish, making it safer for build steps that require devDependencies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:56:11.875222+00:00— report_created — created