永远+ Nodemon一起运行 [英] Forever + Nodemon running together
问题描述
有什么办法可以使这两个软件包一起运行?
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屋!