LinuxCommandLibrary

npm-start

TLDR

Run start script

$ npm start
copy
Start with arguments
$ npm start -- [args]
copy
Start in silent mode
$ npm start --silent
copy

SYNOPSIS

npm start [-- args]

DESCRIPTION

npm start runs the "start" script defined in package.json. If no start script is defined, it defaults to "node server.js".
This is a shorthand for "npm run start" and is commonly used to launch applications.

PARAMETERS

--

Pass arguments to script.
--silent
Reduce output.
--ignore-scripts
Don't run scripts.

PACKAGE.JSON

$ {
  "scripts": {
    "start": "node app.js",
    "start:dev": "nodemon app.js",
    "start:prod": "NODE_ENV=production node app.js"
  }
}
copy

COMMON START SCRIPTS

$ # Node.js
"start": "node index.js"

# React (Create React App)
"start": "react-scripts start"

# Next.js
"start": "next start"

# Express
"start": "node server.js"
copy

CAVEATS

Defaults to "node server.js" if no script defined. Use -- to pass arguments. Exit code reflects script exit code.

HISTORY

npm start was established as the conventional entry point for Node.js applications, becoming a de facto standard.

SEE ALSO

Copied to clipboard