nodemon: Nodemon crashes first restart then works ok the second one when started like nodemon --inspect=0.0.0.0:9229 app.js
nodemon --inspect=0.0.0.0:9229 /app/server.js
inside a container based on
FROM node:8.1.0
with a shared volume on sources. Whenever I save a file on the sources volume, nodemon restarts but crashes with
[nodemon] restarting due to changes...
nodemon bus emit: restart +13s
nodemon bus.emit(exit) via SIGUSR2 +14ms
nodemon bus emit: exit +0ms
[nodemon] starting `node --inspect=0.0.0.0:9229 /app/server.js`
nodemon spawning node --inspect=0.0.0.0:9229 /app/server.js +1ms
nodemon bus emit: start +7ms
nodemon bus new listener: exit (1) +1ms
nodemon start watch on: *.* +0ms
nodemon:watch early exit on watch, still watching (1) +1ms
Starting inspector on 0.0.0.0:9229 failed: address already in use
[nodemon] app crashed - waiting for file changes before starting...
Re-saving the same file, again restarts but works ok this time.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 15
- Comments: 18 (2 by maintainers)
Just kill inspector and start inspector again here is our team’s solution in our package.json
I just ran into this and I very much agree with @kasvtv, it seems very strange to just close the issue. Running dev environments in docker containers seems pretty common these days?
I don’t understand how this got closed. This is a pretty common setup and the workaround is hacky.
Short reply - I don’t use docker (not once for any client project or side project), so please send PR to fix with tests that show the fix works. Happy to merge. Otherwise, this issue is closed because there’s a solution (pending your PRs). Sorry (docker) folks, just saying ‘I think this is strange’ doesn’t solve the core issue. Ta.
That is a npm package. A command line tool. @Dim73
MacOS equivalent for
fuserwhich doesn’t ship with thekflag:nodemon --exec lsof -nti:56745 | xargs kill -9; node --inspect=0.0.0.0:56745 index.js@DimitrK Keep in mind that
1.18.7and above resolves a major vulnerability with pstree:https://github.com/remy/nodemon/commit/21e052e
Nowaday it’s super common to have nodemon running on docker containers, so I think this ticket should be reopened. I don’t know how nodemon works internally but I think having an internal flag that indicates to process to close the port and then watch files again could be a simple workaround.
Hey everyone, updating nodemon from version 1.18.6 to 1.18.9 fixed the issue for me.
I ran into this issue as well when using nodemon with the inspect flag within a docker container. Oddly, it only seems to happen when I add heapdump to the project along with the requisite python dependency for node-gyp. If I remove heapdump, it works as expected.
Perhaps this is related to using a native module somehow?