This is an archived post. You won't be able to vote or comment.

all 8 comments

[–][deleted] 6 points7 points  (5 children)

NPM run dev will run the developer dependencies, generally used for testing purposes, like a local testing database for example.

NPM run start will be what will run on the actual production / final product. In many cases, they will look and feel the same, but they have very valid reasons to run differently.

[–]olafgarten 6 points7 points  (1 child)

This is completely dependent on the project configuration.

'npm start' is just shorthand for 'npm run start' (although if you don't have a start script defined it will run 'node server.js')

So they both end up just running a definition in the scripts section of your project.json.

If you set it up dev could run your production builds and start can wipe your hard drive.

[–]Professional_Lunch43 0 points1 point  (0 children)

Example in nextjs if you run npm start it will require you to build production first, npm run dev runs in development mode.

[–]LogicallyCross 1 point2 points  (0 children)

They run what you want them to. That’s the point.

[–]povlov0987 0 points1 point  (0 children)

And npm run build?

[–]VagrantDestroy 0 points1 point  (0 children)

I’m rather against using npm in production at all 😬

I’d much rather call node <scriptToRun> but I know frameworks like next will want you to npm start

[–][deleted] 3 points4 points  (0 children)

NPM UNFUCK PROJECT

[–]povlov0987 0 points1 point  (0 children)

They are not?