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.5 as a dependency in any project
- Run
npm ci in a clean CI environment (e.g., GitHub Actions with ubuntu-latest)
- The install process hangs indefinitely at the
prepare script 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
Problem
When installing
pdf-parse@2.4.5as a dependency,npm cihangs indefinitely in CI environments (e.g., GitHub Actions).The root cause is the
"prepare": "npm run build"script inpackage.json. Thepreparelifecycle script runs automatically duringnpm install/npm cifor 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
pdf-parse@2.4.5as a dependency in any projectnpm ciin a clean CI environment (e.g., GitHub Actions withubuntu-latest)preparescript stageExpected behavior
npm cishould complete without running a build step, since the published package already includes pre-built files indist/.Workaround
Add the following to
.npmrcto skip the script for this package specifically:This works because the published tarball already contains the compiled
dist/directory, so thepreparebuild is unnecessary for consumers.Suggested fix
The
preparescript should be moved toprepublishOnlyso it only runs when publishing the package, not when consumers install it:Or alternatively, remove
prepareentirely and rely on a manual build step before publishing.Environment
ubuntu-latest)