为什么我的节点应用程序过程中不断得到停止,当我使用下去吗?我的、当我、节点、过程中

2023-09-11 08:23:57 作者:秂赱ヾ苶凉

在一个自由层Amazon EC2实例,我成立了一个简单的node.js的Hello World应用程序的EX preSS运行。

On a free-tier Amazon EC2 instance, I set up a simple node.js Hello World app running on express.

如果我跑 NPM启动,我的应用程序运行正常,我可以从我的浏览器中点击它,我看到下面的输出:

If I run npm start, my app runs fine and I can hit it from my browser, and I see the following output:

> myappname@0.0.0 start /home/ec2-user/app
> node ./bin/www

我已经在全球安装了永远的工具。当我运行永远启动app.js ,我看到:

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: app/app.js

然而,当我检查永远列出,我看到进程已停止:

However, when I check forever list, I see that the process has stopped:

info:    Forever processes running
data:        uid  command             script forever pid  id logfile                          uptime  
data:    [0] 2v0J /usr/local/bin/node app.js 2455    2457    /home/ec2-user/.forever/2v0J.log STOPPED 

这是日志中的唯一消息:错误:永远的检测脚本被打死信号:空

This is the only message in the log: error: Forever detected script was killed by signal: null

我无法找到任何其他日志信息。为什么它会立即继续停止?

I'm unable to find any other log information. Why does it keep immediately stopping?

编辑:我尝试运行它作为 NOHUP永远启动app.js ,得到了同样的问题。我跑了永远启动在同一个SSH会话,一前一后永远地列出。该应用程序的过程似乎立即停止。

I tried running it as nohup forever start app.js and got the same problem. I'm running the forever start and the forever list in the same ssh session, one after the other. The app's process seems to stop immediately.

推荐答案

我能解决我的问题,由于对类似的问题这样的回答: http://stackoverflow.com/a/24914916/1791634

I was able to resolve my problem thanks to this answer on a similar question: http://stackoverflow.com/a/24914916/1791634

这个过程持续运转,当我用,而不是通过app.js 永远启动./bin/www

The process kept running when I used forever start ./bin/www instead of passing app.js

这还有待观察,这是否会导致在道路上的任何困难。

It remains to be seen whether this causes any trouble down the road.