如何 运行 angular 2 个应用在后台

How to run angular 2 app in background

我已经尝试了以下解决方案,但它不起作用。

sudo forever start -c "npm start" ./

和package.json文件是这样的,看启动命令:(这个不全package.json)

"name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "lite": "lite-server",
    "gulp": "gulp",
    "start": "concurrent \"npm run gulp\" \"npm run lite\" ",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },

我要借鉴 this question,最重要的是这部分:

nearly every Linux distro comes with systemd, which means forever, monit, etc are no longer necessary - your OS already handles these tasks.

您可以为 angular2-quickstart 配置一个服务文件,您的 OS 的 systemd 可以使用它来为您的应用程序启动后台进程。 Here 是一篇关于在 Linux 环境中部署应用程序的文章,可以提供帮助。

我找到了 angular-cli,这有助于我部署我的 angular 2 应用程序。