Nodemon这可能会导致高CPU使用率。减少使用 - 手表

时间:2015-07-09 07:12:07

标签: node.js nodemon

即使我使用--watch ..

运行nodemon,我也会收到警告
$nodemon app.js --watch
9 Jul 09:09:16 - [nodemon] v1.3.7
9 Jul 09:09:16 - [nodemon] to restart at any time, enter `rs`
9 Jul 09:09:16 - [nodemon] watching: *.*
9 Jul 09:09:16 - [nodemon] starting `node app.js`
Example app listening at http://:::3000
9 Jul 09:09:16 - [nodemon] watching 32,639 files - this might cause high cpu usage. To reduce use "--watch".

1 个答案:

答案 0 :(得分:4)

减少将要观看的文件数量。您必须指定要观看的目录:https://github.com/remy/nodemon#monitoring-multiple-directories

您还可以通过指定要观看的文件扩展名来减少此数字: https://github.com/remy/nodemon#specifying-extension-watch-list

或者忽略某些路径,例如node_modules: https://github.com/remy/nodemon#ignoring-files