xif
xif

Reputation: 343

Npm start in background on a server after SSH connection (EC2)

I have an app that I start with "npm start" I would like to run it in background. This app is hosted on aws EC2.

I tried :

Thanks a lot for your help

Upvotes: 1

Views: 1621

Answers (4)

Dmitrii Iakovenko
Dmitrii Iakovenko

Reputation: 1

You can add a new command (nohup) to your package.json:

  "scripts": {
    "start": "vue-cli-service serve",
    "nohup": "nohup vue-cli-service serve &"
  },

It should copy your start command, but surround it with nohup and &

Upvotes: 0

xif
xif

Reputation: 343

Actually the process stop after few hours with screen

Upvotes: 1

xif
xif

Reputation: 343

I will try the docker style next time because im running out of time. I found a way using :

"screen" command !

Upvotes: 1

Jim
Jim

Reputation: 669

You have to use docker. You will need to read a lot the documentation, because it's complicated to understand if you dont know it : https://docs.docker.com/get-started/

But it does exactly what you want, running app in background in a container. You can close everything your app will still run.

Enjoy reading !

Upvotes: 1

Related Questions