ENOENT 📦 npm

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

  1. cd into the folder containing package.json
  2. npm init -y for a new project
  3. Use -w/--prefix to target a workspace

Detailed fix by platform

npm

  1. ls package.json && npm install

How to diagnose

  1. Directory — pwd contains package.json?
  2. 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.