Coding⏱️ 2 min read📅 2026-05-31

How to Fix: Local package.json exists, but node_modules missing

Quick Answer: The error indicates that the webpack-dev-server command is not found. This is likely because the project uses a custom Webpack configuration and the default server is not installed. Try running npm install or yarn install to reinstall dependencies, then try running npm start again.

The error message indicates that the `webpack-dev-server` command is not found, suggesting a missing or corrupted installation of Node.js or npm. Another possible cause is that the local `package.json` file exists but the `node_modules` directory is missing.

🛑 Root Causes of the Error

  • The local `package.json` file may be outdated or corrupted.

✅ Best Solutions to Fix It

Method 1: Update npm and Node.js

  1. Step 1: Open a terminal or command prompt and run `npm install -g npm@latest` to update npm.
  2. Step 2: Run `nvm install node` (if using nvm) or `brew upgrade node` (if using Homebrew) to update Node.js.

Method 2: Install Dependencies

  1. Step 1: Run `npm install` to install the dependencies specified in the `package.json` file.

🎯 Final Words

To avoid this issue in the future, ensure that your project's dependencies are up-to-date and that you have a valid `package.json` file. Additionally, consider using a package manager like npm or yarn to manage your project's dependencies.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions