I am wondering what would the difference be between npm run dev
and npm run start
.
To my surprise, I could not find much information online about this topic.
Specifically, I'd like to know in the context of React and Next JS.
I noticed that with React, you can start your app by running npm run start
, without the need of running a build first. On the other hand, Next JS doesn't seem to behave in the same way (but I could have done something wrong with the setup).
I tried running a new Next app using npm run start
, as it's a default script in package.json
, but it didn't work. It shows this error: *Error: Could not find a production build*
Instead, running npm run dev
created a .next folder, and started the server on port 3000 with no issues.
Can anyone help me understand how this works?