Express 4 + pm2 手表不工作 [英] Express 4 + pm2 watch not working

查看:32
本文介绍了Express 4 + pm2 手表不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 pm2:

pm2 start bin/www --watch ../

问题是当我更新根文件夹中的 app.js 时,它似乎不是自动重启节点.有什么想法吗?

Problem is that when I update app.js in the root folder, it doesn't seem to be autorestarting node. Any ideas?

推荐答案

想出了一个解决方案:

//processes.json:
    {
      "apps" : [{
        "name"        : "someExpress4App",
        "script"      : "bin/www",
        "watch"       : "../",
        "log_date_format"  : "YYYY-MM-DD HH:mm Z",
      }]
    }

把它放在你项目的根目录下,然后像这样运行你的 pm2:

Put that on the root of your project, then run your pm2 as so:

pm2 start processes.json

这篇关于Express 4 + pm2 手表不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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