npm-start
TLDR
Run start script
$ npm start
Start with arguments$ npm start -- [args]
Start in silent mode$ npm start --silent
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"
}
}
"scripts": {
"start": "node app.js",
"start:dev": "nodemon app.js",
"start:prod": "NODE_ENV=production node app.js"
}
}
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"
"start": "node index.js"
# React (Create React App)
"start": "react-scripts start"
# Next.js
"start": "next start"
# Express
"start": "node server.js"
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
npm(1), npm-run-script(1), npm-test(1)


