DEV Community

Sergey Khomushin
Sergey Khomushin

Posted on • Updated on

Why is "npm start" bad for production?

A large number of documentation and blogs recommend running the server code through npm start, and Amazon AWS documentation is no exception.

Why is it bad?

Let's create a project with common package.json



"sripts": {
  "start": "node server.js"
}


Enter fullscreen mode Exit fullscreen mode

and start our server: npm start.

The server runs, but what about our processes?

npm and node

OMG! The npm process is not only alive but also uses almost the same amount of memory as our server!

Moreover, if we create our package.json with several tasks:



"sripts": {
  "_serve": "node server.js"
  "start": "config-something.sh && npm run _serve"
}


Enter fullscreen mode Exit fullscreen mode

2 npms and node

They are twins...

Solution

Using npm is a great solution for configuring, building, and other short processes. But for the product server, it is better to use node.js directly.

only node

Top comments (0)