How to fix npm ERR! code ENOSCRIPT npm ERR! No script found in npm

npmBEGINNERLOWUpdated Dec 6, 2025· 129 views

The Missing script error occurs when you try to run an npm script that doesn't exist in your package.json. Verify the script name, check you're in the correct directory, and ensure your package.json has the required scripts section.

Quick fix

Fixes ENOSCRIPT

npm run
  1. List available scripts
  2. Verify you're in the correct directory
  3. Check package.json for the script
  4. Check for typos
npm — error
npm run
npm ERR! code ENOSCRIPT
npm ERR! No script found

What this error means

This error means npm couldn't find the script you're trying to run in your package.json file. When you execute `npm run dev` or `npm start`, npm looks for a matching entry in the "scripts" section of package.json. If there's no match, you get this error. The error is straightforward but can occur for several reasons: you might be in the wrong directory, the script might have a different name than expected, or the package.json might not have been properly initialized. This is one of the most common npm errors, especially for developers new to a project or when following tutorials that assume certain scripts exist.

Typical symptoms

  • Error message shows "Missing script: [script-name]"
  • npm run command exits immediately with error code
  • Works for some scripts but not others
  • Error occurs after cloning a repository
  • npm start fails but npm install works fine
  • Script names in documentation don't match actual package.json
  • Tab completion doesn't show the expected script

Common causes

  1. Script name doesn't exist in package.json scripts section
  2. Running npm commands from wrong directory (not project root)
  3. Typo in the script name (e.g., 'npm run bulid' instead of 'build')
  4. package.json was not created or is missing the scripts section
  5. Duplicate scripts object in package.json (second overwrites first)
  6. Project uses different script names than expected (e.g., 'serve' instead of 'start')

How to fix "npm ERR! code ENOSCRIPT npm ERR! No script found"

1List available scripts

Run npm run without any arguments to see all available scripts:

bash
npm run

This shows the complete list of scripts defined in your package.json, helping you find the correct name.

2Verify you're in the correct directory

Make sure you're in the project root where package.json is located:

bash
ls package.json

If the file doesn't exist, navigate to the correct directory:

bash
cd /path/to/your/project
3Check package.json for the script

Open package.json and look for the scripts section:

json
{
  "scripts": {
    "start": "node index.js",
    "dev": "vite",
    "build": "vite build",
    "test": "jest"
  }
}

If your desired script is missing, add it with the appropriate command.

4Check for typos

Common typos include:
- npm run bulid instead of npm run build
- npm run dve instead of npm run dev
- Extra spaces in the command

Script names are case-sensitive, so npm run Dev won't find a script named dev.

5Add the missing script

If the script genuinely doesn't exist, add it to package.json:

json
{
  "scripts": {
    "dev": "next dev",
    "start": "next start",
    "build": "next build"
  }
}

The command depends on your framework (Vite, Next.js, Create React App, etc.).

6Initialize package.json if missing

If there's no package.json at all, create one:

bash
npm init -y

Then add your scripts manually or install your framework, which will set up appropriate scripts.

Advanced notes

Different frameworks use different default script names. Create React App uses start for development, while Vite uses dev. Next.js uses dev for development and start for production. Always check the framework's documentation for expected script names.

The npm start command is special—it runs the "start" script without needing run (unlike npm run build). Similarly, npm test runs the "test" script directly.

In monorepos, you might need to run scripts from a specific workspace:

bash
npm run dev --workspace=packages/frontend

Or from the workspace directory itself. Check your monorepo configuration for the correct approach.

Frequently asked questions

What does "ENOSCRIPT" mean?
json file. json. If there's no match, you get this error.
How do I fix "ENOSCRIPT"?
The Missing script error occurs when you try to run an npm script that doesn't exist in your package.json. Verify the script name, check you're in the correct directory, and ensure your package.json has the required scripts section.
What causes "ENOSCRIPT"?
Script name doesn't exist in package.json scripts section Running npm commands from wrong directory (not project root) Typo in the script name (e.g., 'npm run bulid' instead of 'build')
Is the "ENOSCRIPT" error serious?
It is a low-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading