-
-
Notifications
You must be signed in to change notification settings - Fork 17
"prepare" script causes npm ci to hang in CI environments #95
Description
Problem
When installing pdf-parse@2.4.5 as a dependency, npm ci hangs indefinitely in CI environments (e.g., GitHub Actions).
The root cause is the "prepare": "npm run build" script in package.json. The prepare lifecycle script runs automatically during npm install / npm ci for consumers of the package — not just for development. This triggers a full build (tsc, api-extractor, vite build, esbuild) which either fails silently or hangs because the build dev dependencies are not available in the published tarball.
Steps to reproduce
- Add
pdf-parse@2.4.5as a dependency in any project - Run
npm ciin a clean CI environment (e.g., GitHub Actions withubuntu-latest) - The install process hangs indefinitely at the
preparescript stage
Expected behavior
npm ci should complete without running a build step, since the published package already includes pre-built files in dist/.
Workaround
Add the following to .npmrc to skip the script for this package specifically:
pdf-parse:ignore-scripts=true
This works because the published tarball already contains the compiled dist/ directory, so the prepare build is unnecessary for consumers.
Suggested fix
The prepare script should be moved to prepublishOnly so it only runs when publishing the package, not when consumers install it:
"prepublishOnly": "npm run build"Or alternatively, remove prepare entirely and rely on a manual build step before publishing.
Environment
- npm 10.x
- Node.js 20.x
- GitHub Actions (
ubuntu-latest) - pdf-parse 2.4.5