Home › npm & Node.js

npm ERR! enoent Could not read package.json — how to fix

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/user/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/user/package.json'
npm ERR! enoent This is related to npm not being able to find a file.

Quick fix: Check the path in the error. cd into the folder that contains package.json and run the command again. Starting a new project? Run npm init -y.

What it means

npm looks for package.json in the current folder. The path line in the error shows where it looked, and there's no file there.

Fixes

Wrong folder (most common, especially right after git clone or npx create-...):

ls                 # is package.json here?
cd my-project
npm install

New project: create a package.json:

npm init -y

Monorepos: the package.json you want may be in a subfolder (frontend/, packages/app/). cd into it, or use workspaces: npm run build -w packages/app.

Typo in the file name: it must be exactly package.json (not Package.json or package.json.txt; Windows hides known extensions by default).

ENOENT for other files

The same ENOENT code appears for any missing file, for example:

Last updated 2026-10-27.