Skip to content
Latchkey

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

  1. Confirm where package.json lives in the repo.
  2. Set the working directory for the install step to that folder.
Workflow
- name: Install
  working-directory: ./app
  run: npm ci

Ensure the repo is checked out first

  1. Add the checkout step before any npm step.
  2. Verify the path with ls so the manifest is present.
Workflow
- uses: actions/checkout@v4
- run: ls package.json && npm ci

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →