看起来当我执行fs.writeFile()时,更改后的文件将重新启动nodemon.如何使其不重启? [英] Looks like when I do fs.writeFile(), the changed file restarts nodemon. How to make it not restart?

查看:160
本文介绍了看起来当我执行fs.writeFile()时,更改后的文件将重新启动nodemon.如何使其不重启?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为正在发生的事情是,对于用猫鼬更新集合的回调,我对all.json进行了writeFile,我认为这导致我的nodemon重新启动.

I thinks what is happening is that for a callback to update a collection in mongoose I do a writeFile to all.json and I think that is causing my nodemon to restart.

cmd窗口:

file saved
[nodemon] restarting due to changes...
{ ok: 1, nModified: 0, n: 1 }
Anon user added to doc
{ ok: 1, nModified: 1, n: 1 }
[nodemon] starting `node server.js`
listenting on port: 3000

我不希望它在all.json更改时重新启动.

I don't want it to restart when all.json changes.

重新启动时会得到一个新会话,并且我想在开发时对该会话进行处理.我现在不想使用mongo-store或session store.我只是不想让节点重新启动或获得新会话,但我想在不使用会话参数的情况下对其进行修复.

I get a new session when it restarts and I want to do stuff with that session while developing. I don't want to use mongo-store or session store right now. I just don't want node to restart or get a new session but I want to fix it without playing around with the session parameters.

所以请确认,因为all.json文件更改,这就是nodemon重新启动的原因.我知道它不会针对玉石或ejs文件重新启动,但我不知道json

So please confirm that because the all.json file changes that is why nodemon restarts . I know that it doesn't restart for jade or ejs files but I didn't know about json

也请提出解决方案.

推荐答案

将正在创建的文件名添加到名为nodemon.json的文件中,并将其放置在工作文件夹的根目录中:

Add the name/s of the file/s you're creating to a file called nodemon.json, and place it at the root of your working folder:

{
  "ignore": ["*.test.txt", "myfiles/*"]
}

此处中查看其他选项.

这篇关于看起来当我执行fs.writeFile()时,更改后的文件将重新启动nodemon.如何使其不重启?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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