Solving npm ERR! missing script: start in Node.js

Updated: December 28, 2023 By: Guest Contributor Post a comment

The npm ERR! missing script: start error in Node.js occurs when the npm start command is executed, but no start script is defined in the package.json file of the Node.js project. Here’s how to fix it:

Understanding the Error

When you run npm start, npm looks for a script definition named ‘start’ in your project’s package.json file. If it doesn’t find one, it produces the npm ERR! missing script: start error.

Steps to Fix the Error

  1. Open the package.json file in the root of your Node.js project.
  2. Locate the "scripts" section. If it doesn’t exist, you’ll need to add it.
  3. Inside the "scripts" section, add a start property with the command you want to run when you execute npm start. The most common start script for a Node.js project is "node server.js", where server.js is the entry point file of your application.

Example of a Corrected package.json

  "name": "your-project",
  "version": "1.0.0",
  "description": "A Node.js project",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  "dependencies": {
    "express": "^4.17.1"

With this addition, running npm start will execute the node server.js command.

Alternative Fixes

If you have a different entry point file or want to perform additional tasks when starting your application, adjust the script accordingly, for example:

"scripts": {
  "start": "node app.js"

Or if you are using a tool like nodemon for automatic reloading:

"scripts": {
  "start": "nodemon app.js"

Once you have added the appropriate start script to your package.json, save the file and run npm start again. This should resolve the error and start your Node.js application as expected.