2

I have an Vue application created with vue-cli (vue create my_app). It runs normally when I open the terminal, run the command npm run serve and access localhost:8080, but it stopped when I close the terminal.

How can I keep the program running when the terminal is closed ?. I have tried to use pm2 and node-windows but without success.

package.json:

"scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  }
Canatto Filipe
  • 569
  • 7
  • 15

1 Answers1

3

When you are running npm run serve there is dev server starting. It's obvious that if you close terminal window the process will terminate. If you want to run app in developer mode its better just not to close the terminal window. Other variant is to run npm run build, collect the files from the dist folder and then serve it with your preferable web server. If you are using Google Chrome you can try Web Server for Chrome

Justice47
  • 682
  • 6
  • 16