nodemon -v: 1.14.11node -v: v8.9.1nodemon scripts/bin/server.js --ignore dist --ignore coverage --ignore tests --ignore src --ignore cypressNodemon launches server, afterwards the process' CPU usage drops to ~0%.
Nodemon launches server but its process is permanently using up a full CPU core
/
I've verified that this behavior only starts manifesting in 1.4.11, 1.4.10 does not suffer from this.
If there's anything else you want me to provide you, please let me know.
Dump:
--------------
node: v8.9.1
nodemon: 1.14.11
command: C:\Tools\nodejs\node.exe C:\Projects\<PROJECT_DIR>\node_modules\nodemon\bin\nodemon.js scripts/bin/server.js --ignore dist --ignore coverage --ignore tests --ignore src --dump
cwd: C:\Projects\<PROJECT_DIR>
OS: win32 x64
--------------
{ run: false,
system:
{ cwd: 'C:\\Projects\\<PROJECT_DIR>' },
required: false,
dirs:
[ 'C:\\Projects\\<PROJECT_DIR>' ],
timeout: 1000,
options:
{ ignore:
[ '**/.git/**',
'**/.nyc_output/**',
'**/.sass-cache/**',
'**/bower_components/**',
'**/coverage/**',
'**/node_modules/**',
'dist',
'coverage',
'tests',
'src',
re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*|dist|coverage|tests|src/ ],
dump: true,
watch: [ '*.*', re: /.*\..*/ ],
ignoreRoot:
[ '**/.git/**',
'**/.nyc_output/**',
'**/.sass-cache/**',
'**/bower_components/**',
'**/coverage/**',
'**/node_modules/**' ],
restartable: 'rs',
colours: true,
execMap: { py: 'python', rb: 'ruby' },
stdin: true,
runOnChangeOnly: false,
verbose: false,
signal: 'SIGUSR2',
stdout: true,
watchOptions: {},
execOptions:
{ script: 'scripts/bin/server.js',
exec: 'node',
args: [],
scriptPosition: 0,
nodeArgs: undefined,
execArgs: [],
ext: 'js,mjs,json',
env: {} },
monitor:
[ '*.*',
'!**/.git/**',
'!**/.nyc_output/**',
'!**/.sass-cache/**',
'!**/bower_components/**',
'!**/coverage/**',
'!**/node_modules/**',
'!C:\\Projects\\<PROJECT_DIR>\\dist/**/*',
'!C:\\Projects\\<PROJECT_DIR>\\coverage/**/*',
'!tests',
'!C:\\Projects\\<PROJECT_DIR>\\src/**/*' ] },
load: [Function],
reset: [Function: reset],
lastStarted: 0,
loaded: [],
watchInterval: null,
signal: 'SIGUSR2',
command:
{ raw: { executable: 'node', args: [ 'scripts/bin/server.js' ] },
string: 'node scripts/bin/server.js' } }
--------------
Can you give me the initial output of nodemon using the -V flag?
to be executed: "nodemon scripts/bin/server.js --ignore dist --ignore coverage --ignore tests --ignore src -V"
[nodemon] 1.14.11
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 19000 to restart
[nodemon] ignoring: .\dist/**/* .\coverage/**/* tests .\src/**/*
[nodemon] watching: *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node scripts/bin/server.js`
[nodemon] forking
[nodemon] child pid: 3332
tests is a directory that does not seem to exist anymore, which is why it is not globbed I guess. Leaving it out makes no difference.
Running it on 1.14.10 gives me the actual file count at the bottom, not getting this on 1.14.11:
to be executed: "nodemon scripts/bin/server.js --ignore dist --ignore tests --ignore coverage --ignore src -V"
[nodemon] 1.14.10
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 17172 to restart
[nodemon] ignoring: .\dist/**/* tests .\coverage/**/* .\src/**/*
[nodemon] watching: *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node scripts/bin/server.js`
[nodemon] forking
[nodemon] child pid: 18444
[nodemon] watching 16 files
Hmm, I suspect the CPU hogging is nodemon actually counting up the files…
I'm investigating.
I'm pretty confident this is a windows (perhaps cmdr) specific. Running cmdr locally on a near empty directory yields the following:
C:\Users\Demo\nodemon-windows ([email protected])
λ ll
'll' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Demo\nodemon-windows ([email protected])
λ ls
http.js node_modules/ package-lock.json package.json
C:\Users\Demo\nodemon-windows ([email protected])
λ nodemon -V http.js
[nodemon] 1.14.11
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 1188 to restart
[nodemon] watching: *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node http.js`
[nodemon] forking
[nodemon] child pid: 13744
this was added
ok.
[nodemon] watching 1302 files
Note the 1302 files - I suspect it's going in an walking the node_modules directory.
You're right, adding --ignore node_modules seems to work around this issue. Never occurred to me to try this yesterday 😄.
Fwiw, native windows prompt has the same problem, so it's not limited to cmder/ConEmu.
Found the related issue on Chokidar and I'm about to send a PR to fix.
Awesome, thank you!
Just to let you know, I'm still waiting for the chokidar 2.0.1 release to land. My change got merged in, but they're still holding back the release (I'm assuming for other patches to settle first).
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3
Still waiting on Chokidar
I’m having the same (or a very similar) issue on macOS 10.13.3 — the node process stays at around 100% CPU for a prolonged time, after which it eventually drops to normal levels. My guess was that this would be due to indexing — perhaps node_modules — but the documentation says that node_modules is excluded by default, and including --ignore node_modules as suggested above doesn’t seem to work.
@lensbart this issue is a specific windows bug - and I'm not sure the symptoms are caused by the same root issue. Can you provide details on exactly how you're using and running nodemon? It's possible you're seeing this issue instead.
@remy it seems to be a different issue still, as I’m not specifying a --watch option as is the case in the suggested link.
nodemon -v: 1.14.12node -v: v8.9.4nodemon --ignore ./node_modules ./build/app.js, nodemon --ignore ../node_modules ./build/app.js, nodemon --ignore node_modules ./build/app.js and nodemon --ignore node_modules/ ./build/app.js@lensbart cheers for those, I've got a _very_ similar environment, so I'll setup a local test to see what's going on. It should _definitely_ be ignoring the node_modules directories. I might file a new issue for this if there's something going on (again, the issue we're commenting on here is directly linked to use on Window).
Thanks for raising this issue, and hopefully you're happy with @remy's fix. If you'd like to support this project, you can do just that through the open collective https://opencollective.com/nodemon/donate or at the very least, starring this project would give me @remy a little smile ❤️
Solved:- I am MacBook Air [OS Mohave] User, same problem with me, I just Quit the Sublime and started using VS Code, Problem is gone. I think the problem is with Sublime JSLinter.