更改后 Nodemon 会重启两次 [英] Nodemon restart twice when change is made
问题描述
我正在使用 nodemon 以便在进行更改时重新启动应用程序.它工作得很好,但是它重新启动了两次,因此有时读取从服务器返回的数据(如 console.log)有点忙,因为它重新加载了两次.
I am using nodemon in order to restart the app when change is made. It works good however it restart two times and thus sometimes it is a bit busy to read data returned from server (like console.log) since its reloaded twice.
我正在谈论这样的事情:
I am talking about something like this:
[nodemon] starting `node app.js`
Connected to db and listening on port 8080
[nodemon] restarting due to changes...
[nodemon] starting `node app.js`
Connected to db and listening on port 8080
我正在使用 Atom IDE.
I am working with Atom IDE.
如果此问题缺少信息,请发表评论,如果信息不完整,我会更新.
If this question is missing information, please comment and I will update in case its not fully informative.
感谢您的支持.
推荐答案
可能的解决方案:
我将首先查看 nodemon 正在监视的文件/目录集.它当前可能被配置为监视两个不同的服务器文件,这就是为什么它会为单个文件更改重新启动两次.如果您确实如此,那么解决方案就像更改配置以仅管理一个扩展程序一样简单.
I would start by looking into the set of files/directories nodemon is watching. It may be currently configured to watch two different server files which is why it would restart twice for a single file change. If this is true for you, the solution is as simple as changing your config in order to manage only one extension.
这篇关于更改后 Nodemon 会重启两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!