Home > Software engineering >  Starting a vueJS app with PM2 starts an empty process instead
Starting a vueJS app with PM2 starts an empty process instead

Time:10-15

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?

CodePudding user response:

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.

CodePudding user response:

S3 is not a good place for an app, it's more for assets since it's quite slow AFAIK. But you can host it there if you really want to host on AWS.
More difficult to connect to the backend? Not really, pretty much the same: target an URL.
You could micro-optimize it on the same provider with kubernetes and all, but this is probably out of the scope here.

  • Related