Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

npm start fails because react-scripts is not found

Errorsh: react-scripts: command not found

Short answer

npm runs scripts with node_modules/.bin on the PATH. If react-scripts is not found, it is not installed in this folder: you never ran npm install, you are in the wrong directory, or devDependencies were skipped because NODE_ENV is production. Install again with dev packages included.

  • Applies to npm 10, Node.js 22, react-scripts 5
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check whether the folder has a package.json and whether the binary exists in node_modules.

    ls package.json node_modules/.bin/react-scripts
  2. 2Match what you see, then jump to its fix

    1. 1ls: node_modules/.bin/react-scripts: No such file or directoryDependencies were never installed in this folderFix
    2. 2npm install finishes, but react-scripts is still missing and the project lists it under devDependenciesdevDependencies were skipped because NODE_ENV is productionFix
    3. 3The project was created with create-react-app and installs keep breaking on newer Node.js or ReactThe project is Create React App, which is deprecatedFix

What does the error look like?

  • sh: react-scripts: command not found
  • react-scripts: command not found

Cause 1 of 3

Dependencies were never installed in this folder

1Check

npm run adds node_modules/.bin to PATH, so the command exists only when the package is installed locally. A fresh clone has no node_modules.

pwd
ls node_modules | head

2Fix

Change into the folder that holds package.json and install the dependencies.

cd path/to/project
npm install

3Verify

The binary is present and the script starts.

ls node_modules/.bin/react-scripts
npm start

Confirmed by docs.npmjs.com

Did this fix it?

Cause 2 of 3

devDependencies were skipped because NODE_ENV is production

1Check

With NODE_ENV=production, npm does not install modules listed in devDependencies.

echo "$NODE_ENV"
npm config get omit

2Fix

Install with dev packages included, or unset the variable before the install. A build step on a server needs them.

npm install --include=dev

3Verify

The binary now exists, and the build runs.

ls node_modules/.bin/react-scripts
npm run build

Confirmed by docs.npmjs.com

Did this fix it?

Cause 3 of 3

The project is Create React App, which is deprecated

1Check

React's team deprecated Create React App on 14 February 2025 for new apps; it stays in maintenance mode, with no active maintainers.

grep -n "react-scripts" package.json

2Fix

To keep working, reinstall as above. For a long-term fix, migrate to a framework such as Next.js or React Router, or to a build tool such as Vite, Parcel or Rsbuild; React links a migration guide for each.

npm install
npm start

3Verify

The dev server starts while you plan the migration.

npm start

Confirmed by react.dev

Did this fix it?

How do I stop it coming back?

  • Run npm install after every clone and after switching branches that change package.json.
  • Commit package-lock.json so installs are repeatable.
  • Do not set NODE_ENV=production for the install step of a build that needs dev tools.
  • Plan a move off Create React App while the project is small.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.