永远+ Nodemon一起运行 [英] Forever + Nodemon running together

查看:167
本文介绍了永远+ Nodemon一起运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以使这两个软件包一起运行?

Is there any way to have both of this packages running together?

所以基本上,我希望两全其美.自动运行服务器(并在发生错误时重新启动),并在发生.js文件更改时自动更新.

So basically I want to have best from both worlds. Running server automatically (and restarting when there is an error) and also automatic updates when there is .js file change happening.

推荐答案

Toxa步入正轨,这是 cfogelberg提出的问题有效,但为避免该问题,您可以执行以下操作:

Toxa was on the right track, the issue that cfogelberg raised is valid, but to avoid that issue you can do the following:

forever -c "nodemon --exitcrash" app.js

这可以确保nodemon实际退出(而不是给您应用程序崩溃"消息),然后forever再次将其接收.

this makes sure nodemon actually exits (rather than giving you the "app crashed" message) and then forever picks it up again.

forever --help中,此-c指定要运行的命令,否则默认为节点.不使用-c会导致在此答案的注释中提及的错误.

In forever --help this -c specifies a command to run otherwise it defaults node. Without -c results in the error that is mention in the comments to this answer.

这篇关于永远+ Nodemon一起运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆