Vue.js dev server is incrementing the port when using yarn serve?

502 views Asked by At

When building my Vue development server (yarn serve) each time I run it the port my project is being served on is incremented by 1 (3000 to 3001) each time I run yarn serve I am also making sure to exit the previous process...

Is there any known reason this is happening? I've have tried searching for this but have seen nothing similar to this.

My package.json scripts block:

  "scripts": {
    "serve": "vue-cli-service serve --port 3000",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  }
1

There are 1 answers

0
kissu On BEST ANSWER

This is probably because you still have a running service on the port 3000, that's why it's incrementing itself. Try using

sudo lsof -i -P -n | grep 3000

or

sudo netstat -nlp | grep :80

Then, you could kill it with specific CLI command or a basic kill 11528 (kill + PID of the process). You could also use a SIGKILL with kill - 9 PID if the process doesn't want to shutdown.

enter image description here

PS: also, you should have a notice of it when you launch your server. enter image description here