vue.js – My Vue application is not running when using pm2

I have a Vue application and I can run it using

vue-cli-service serve

I go to localhost:8080 in the browser and see my application running

But I wanted to run it with pm2 as I want to start the application and the test it using cucumber

I have a server.js file

    module.exports = {
  apps: [
    {
      name: "WEB",
      script: "./node_modules/@vue/cli-service/bin/vue-cli-service.js",
      args: "serve",
    },
  ],
};

And I run it with the command

pm2 start server.js

I see the following in the terminal

│ id │ name │ mode │ ↺ │ status │ cpu │ memory │

│ 0 │ server │ fork │ 0 │ online │ 0% │ 42.9mb │

I go to localhost:8080 but the application is NOT running

If I test with cucumber I get failed tests as the website is not available

Please can you tell me what I am doing wrong ?
How can I get pm2 to run vue-cli-service serve and make the website available at localhost:8080

Read more here: Source link