PlainError

npm ERR! code ENOENT: no such file or directory, open 'package.json'

Last checked 2026-11-02 · 3 fixes · reviewed answer

TL;DRnpm is trying to open a file called package.json in the current folder but cannot find it. This file lists your project's dependencies and scripts, so most npm commands fail without it.

Most likely cause: You are running the npm command from the wrong folder (not the project root that contains package.json)

Try first: Check which folder you are in (pwd && ls)

Likely causes

  1. You are running the npm command from the wrong folder (not the project root that contains package.json)most likely
  2. The package.json file is missing because the project was not initialized or the file was deletedpossible
  3. A path or filename was typed incorrectly in the commandless likely

How to fix it

Safest first: SafeChanges settingsDangerous
  1. Check which folder you are inSafe

    Run this to see the current directory and list files so you can confirm whether package.json exists there.

    pwd && ls
  2. Move into the correct project folderSafe

    Change directory to the folder that actually contains your package.json file.

    cd /path/to/your/project
  3. Create a new package.json if the project has noneChanges settings

    If this is a new project, initialize it so npm can create the missing file.

    npm init -y

If that didn't fix it

Run 'ls' (or 'dir' on Windows) in the folder and verify the exact spelling and location of package.json before retrying the original npm command.

When to see a technician

See a technician only if you are working inside a shared or production codebase and cannot locate the correct project files.

Quick answers

What does npm ERR! code ENOENT: no such file or directory, open 'package.json' mean?
npm is trying to open a file called package.json in the current folder but cannot find it. This file lists your project's dependencies and scripts, so most npm commands fail without it.
What causes npm ERR! code ENOENT: no such file or directory, open 'package.json'?
You are running the npm command from the wrong folder (not the project root that contains package.json). (most likely) The package.json file is missing because the project was not initialized or the file was deleted. (possible) A path or filename was typed incorrectly in the command. (less likely)
How do I fix npm ERR! code ENOENT: no such file or directory, open 'package.json'?
Try these in order, safest first: 1. Check which folder you are in. 2. Move into the correct project folder. 3. Create a new package.json if the project has none.
What if that didn't fix it?
Run 'ls' (or 'dir' on Windows) in the folder and verify the exact spelling and location of package.json before retrying the original npm command.
When should I see a technician?
See a technician only if you are working inside a shared or production codebase and cannot locate the correct project files.
Did this fix it? Report a problem

Related errors

All Coding errors →