Search code examples
vue.jsdeploymentpm2

Starting a vueJS app with PM2 starts an empty process instead


pm2 start npm -- serve
pm2 start npm --watch -- run dev
pm2 start npm --name "vue-app" -- start
sudo pm2 start npm run serve --name vue-app -- start

When I run those it will start a process but not my app because when I do sudo lsof -i -P -n | grep LISTEN I don't see the 8080 port being used, either that or I get "script not found".

Here is my package.json:

{
  "name": "vue-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
}

Since at least one of those commands have to be correct, do I have to modify my package.json file?


Solution

  • What I did to make it work was cd into the root folder of the frontend and run this command:

    pm2 serve dist 8080 --spa

    But as kissu mentioned I'll need to move it to a different host since it's a static app, amplify or netlify for exemple.