Last weekend, I was cooking dinner. Nothing fancy—just pasta. I boiled the water, threw in the pasta, started chopping vegetables, and felt like I was in control. But then… chaos.
I forgot the salt, dropped half the veggies, and nearly burned the sauce. The smoke alarm went off, and my kitchen looked like a war zone.
Standing there in the mess exactly like running npm run dev.
What Happens When You Run npm run dev
?
When you type:
npm run dev
you’re not launching the polished final version of your app. You’re starting a development server. That means:
- Things are still messy (like my kitchen).
- Errors will pop up (like my sauce disaster).
- You can fix things on the fly without breaking the “production” version (thankfully no one else was eating that pasta). Here’s the breakdown:
1. It Reads Your Scripts
Inside package.json, you’ll usually find something like this:
Json
"scripts": {
"dev": "next dev"
}
So npm run dev
just tells npm: look up the "dev" script and execute it. Depending on your project, it might be vite
, nodemon
, next dev
, etc.
2. Development Mode, Not Production
This is where you test, debug, and experiment. You get:
Hot reloading (save → auto-refresh).
Detailed errors (friendly logs instead of cryptic crashes).
A local server (usually http://localhost:3000).
3. Why It Matters
It’s a safe playground. Mistakes here don’t ruin the final app—just like messing up pasta in my kitchen didn’t ruin anyone’s dinner party.
Restarting When Things Break
When my sauce burned, I didn’t quit. I just restarted—cleaned the pan, tried again, and this time, it worked.
That’s basically what we do with code:
CTRL + C
npm run dev
Restart. Retry. Learn.
Wrapping It Up
That pasta night taught me a simple lesson:
- Setup takes time (boiling water, starting the dev server).
- Mistakes are normal (burnt sauce, missing dependencies).
- Restarts are part of the process.
- “Dev mode” is where growth happens.
So every time I type npm run dev, I remember: life itself is in development mode. Messy, experimental, but always moving forward.
Keep running dev. Both in projects, and in life.
Top comments (0)