npmstart.
Command guide
中文

How to use the npm start command

npm start runs the start script in package.json. Check the script before running an existing project, or try the two-file example below to start a local Node.js server from scratch.

Start an existing project

Open a terminal in the folder with package.json. Run npm run to list the scripts, then follow the project’s instructions to install dependencies.

List the available scripts
npm run

If the project defines start, run npm start. It can start a development server, run a built app or perform another task defined by the author. If the project only defines dev, follow its instructions for npm run dev. With no start script, npm defaults to node server.js when server.js exists in the project root.

Run a minimal Node.js server

With Node.js and npm installed, create these two files in a new empty folder. Open a terminal in that folder. The example uses only built-in Node.js modules, so you can start it right away.

package.json
{
  "name": "npm-start-demo",
  "private": true,
  "scripts": {
    "start": "node server.cjs"
  }
}
server.cjs
const { createServer } = require('node:http');

const server = createServer((request, response) => {
  response.setHeader('Content-Type', 'text/plain; charset=utf-8');
  response.end('Hello from npm start!');
});

server.listen(0, '127.0.0.1', () => {
  console.log('Open http://127.0.0.1:' + server.address().port);
});
Start the example server
npm start

Open the local URL printed in the terminal. You should see Hello from npm start! The server listens only on your machine and chooses an available port. Press Ctrl+C in the terminal to stop it.

Compare start, dev and build

The actual script definition determines behavior
CommandMeaningBefore running
npm startRuns the start scriptEntry point, dependencies and build prerequisites
npm run devRuns a custom script named devWhether the package defines dev
npm run buildRuns a custom script named buildWhere output goes and how it will run
npm installInstalls or updates dependenciesThe intended package manager and lockfile

dev and build are common names, but authors still define their behavior. Follow upstream yarn or pnpm instructions when applicable; mixing tools can change lockfiles. Our launcher prepares the pinned upstream toolchain instead.

Pass arguments to the underlying script

Only if the underlying command supports --port
npm start -- --port 3000

Arguments after the separator are passed to the script. This example does not mean every program, or every npmstart pack, supports --port. Check the actual command’s documentation and use the URL printed by the running process.

Identify the failing stage

Missing script: start
Inspect the directory and scripts. The project may define dev instead; do not invent an entry point.
command not found / module not found
Check Node.js, dependencies and the intended package manager. Read the first meaningful error.
EADDRINUSE
Another process may occupy the port. Identify it or choose a supported alternative; do not stop unrelated services blindly.
The page will not open
Check that the process is running and use its actual address and protocol. Reloading a browser cannot restart a stopped server.

What npmstart.com launch packs do

npmstart.com is an independent discovery and learning site, not affiliated with npm. Project ZIPs contain a launcher and pinned-source manifest. Initial npm start fetches and verifies source, prepares the upstream toolchain and dependencies, then starts a local development server. Later runs reuse app/. This is not an offline installation or a production deployment.

Official references

Reviewed · Examples describe general behavior; versions and projects can differ.