When using node-java package, nodemon doesn't restart when the files change. If I remove node-java package then nodemon will restart when there are file changes.
Even the manual restart (rs) is not working when using node-java package in server. Following is the behavior.
alon
And even it throws the following:
events.js:85
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Server._listen2 (net.js:1156:14)
at listen (net.js:1182:10)
at Server.listen (net.js:1267:5)
Since the port 4000 is being used only once in server and no where else, its behaving weird.
It seems that node-java somehow magically 'overrides' what's happening when receiving SIGUSR2
signal. In such a case, the SIGUSR2
signal (used by nodemon
) to restart the app may fail terminating the app.
(Quick) Fix:
after the node-java has screwed your SIGUSR2
handling mechanism, add the following snippet of code:
process.once('SIGUSR2', function() {
process.kill(process.pid, 'SIGUSR2')
})
note that you must do this AFTER the node-java
(or something which uses it, in my case it is node-tika
) does its 'job' (in my case, immediately after requiring node-tika
).
To be honest, I have only very little understanding, why this works and I'll be glad if someone can shed more light on this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With