【发布时间】:2016-07-25 13:06:19
【问题描述】:
我有一个 express 节点项目。我通过运行命令启动服务器 npm start 在我本地的项目文件夹中,它按预期工作。
我尝试在远程 linux VM 上运行相同的命令。但是关闭终端后,服务器正在关闭。所以我尝试从 npm start & 和 nohup npm start & 开始。 但是关闭终端服务器后仍然停止。
那么如何在后台启动 express 项目的节点服务器呢?
我的package.json 文件如下所示:
{
"name": "test_project",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "concurrently \"tsc -w\" \"node ./bin/www\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings install",
"bundle": "node bin/bundler.js",
"bundle:prod": "node bin/bundler.js --prod"
},
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0",
"mongodb": "2.2.4",
"request": "~2.73.0"
},
"devDependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/router": "^3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.3",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.12",
"concurrently": "^2.0.0",
"systemjs-builder": "^0.15.17",
"typescript": "^1.8.10",
"typings": "^1.3.0",
"yargs": "^4.7.1"
}
}
【问题讨论】:
-
如果你说
npm start然后disown怎么办?来自How can I close a terminal without killing the command running in it? -
2 分钟后它停止了。 挂断出现在 nohup.out
标签: node.js linux ubuntu express angular