npm ENOENT package.json Not Found in CI - Fix Missing Manifest
ENOENT for package.json means npm looked for the manifest in the current directory and there was no file there. It is almost always a working-directory or checkout problem.
What this error means
An install or run step fails right away with code ENOENT and a path ending in package.json, saying npm could not read the file. Running locally from the project root works fine.
npm
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/runner/work/repo/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '.../package.json'Common causes
The job runs npm from the wrong directory
The package.json lives in a subfolder, but the step runs at the repo root (or vice versa), so npm finds no manifest.
The checkout did not include the manifest
A missing or shallow checkout, or a sparse-checkout that excluded the project folder, leaves no package.json on disk.
How to fix it
Run npm in the directory that contains package.json
- Confirm where package.json lives in the repo.
- Set the working directory for the install step to that folder.
Workflow
- name: Install
working-directory: ./app
run: npm ciEnsure the repo is checked out first
- Add the checkout step before any npm step.
- Verify the path with ls so the manifest is present.
Workflow
- uses: actions/checkout@v4
- run: ls package.json && npm ciHow to prevent it
- Always run actions/checkout before npm, set working-directory explicitly for subfolder projects, and add a quick ls of package.json to fail fast with a clear message.
Related guides
npm ci "can only install with an existing package-lock.json" - Fix in CIFix "npm ci can only install with an existing package-lock.json" by committing a lockfile, since npm ci refus…
npm ELIFECYCLE Error in CI - Diagnose Failing Lifecycle ScriptsFix "npm ERR! code ELIFECYCLE" during install in CI by finding the lifecycle script that exited non-zero and…
npm EACCES Permission Denied in CI - Fix File and Cache PermissionsFix "npm ERR! code EACCES permission denied" in CI by correcting ownership of the npm cache and project direc…