npm ERR! enoent ENOENT: no such file or directory, open '/path/package.json'
npm ran in a directory without a package.json.
Seen on:
npm
Meaning
You’re in the wrong folder (often the parent of the project), or the project hasn’t been initialised.
Common causes
- Running npm from the wrong directory
- Project not initialised
- Monorepo: running in the root instead of a workspace
⚡ Quick fix
- cd into the folder containing package.json
- npm init -y for a new project
- Use -w/--prefix to target a workspace
Detailed fix by platform
npm
ls package.json && npm install
How to diagnose
- Directory — pwd contains package.json?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026