我用的是狼吞虎咽
配置目录只包含一个文件,即server.js。
$.nodemon({
script: 'config/server.js',
watch: ['config/**/*.js']
})
.on('restart', function () {
setTimeout(function () {
$.livereload.changed();
}, 1000);
});输出:
[gulp] [nodemon] v1.2.1
[gulp] [nodemon] to restart at any time, enter `rs`
[gulp] [nodemon] watching: config/**/*.js
[gulp] [nodemon] starting `node config/server.js`
[gulp] [nodemon] watching 34,325 files - this might cause high cpu usage. To reduce use "--watch".如果我包含一个忽略选项,它就会修复。
ignore: [
'node_modules/**',
'bower_components/**'
]为什么没人会监视一切,即使我告诉它只看配置目录?
此外,它还显示在输出中,它只监视配置目录[nodemon] watching: config/**/*.js。
发布于 2014-07-30 18:14:39
这似乎是nodemon本身的一个bug,因为我能够使用简单的nodemon命令再现它:
> nodemon --watch app server.js
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/**/*
[nodemon] starting `node server.js`
[nodemon] watching 72,981 files - this might cause high cpu usage. To reduce use "--watch"nodemon的默认行为是监视项目根目录中的所有目录,并忽略一些目录,如node_modules、bower_components或.sass_cache。这个默认的ignore实际上不起作用,但是用this PR修复的。应用此修补程序,我的输出与预期的一样。
> nodemon --watch app server.js
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/**/*
[nodemon] starting `node server.js`我使用这两种配置进行了测试,即使发出警告,我的nodemon也没有刷新未位于指定的watched目录中的文件更改,而且没有出现任何性能问题。更有可能是对我的假阳性警告。
但现在,我建议您继续使用ignore规则,直到将其合并到nodemon或找到其他解决方法为止。
https://stackoverflow.com/questions/24785186
复制相似问题