47

What is the difference between npm run serve and npm run dev in vuejs. Why should i use npm run serve command to run the project

2
  • 8
    Look at your package.json file. The difference is whatever is defined in that file. It's different for everyone. Commented Mar 18, 2019 at 12:48
  • Refer vue CLI 3, You can find command And also you can use Vue GUI if you want an easy path. Commented Mar 18, 2019 at 12:53

1 Answer 1

73

npm run serve basically is just saying "npm please run the command I defined under the name serve in package.json" the same happens with npm run dev.

Given this the commands can do the exact same thing, similar things, or very different things. Usually they are a shorthand for running a dev server on localhost, but it’s not a rule, only a convention.

So you'll need to check in your package.json file and look for

"scripts": {
    "serve": "[list of commands here]",
    "dev": "[list of commands here]"
},
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.