You must be install node-inspector and nodemon using:
npm install -g nodemon
npm install -g node-inspector
To run in Windows, make a new .bat file and add the folowing lines:
@echo off
echo Starting developer enviroment of the file %1
start nodemon --debug-brk %1
node-debug %1
And run:
node_desarrollo.bat "name of the file to run.js"
If ran with a error:
Error: listen EADDRINUSE :::5858
at Object.exports._errnoException (util.js:855:11)
at exports._exceptionWithHostPort (util.js:878:20)
at Agent.Server._listen2 (net.js:1237:14)
at listen (net.js:1273:10)
at Agent.Server.listen (net.js:1369:5)
at Object.start (_debug_agent.js:21:9)
at startup (node.js:72:9)
at node.js:980:3
Its normal because the node-inspector need to open that port to connect but because the nodemon --debug-brk %1
was opened the 5858 port its cannot open and show the EADDRINUSE :::5858
error, note that the flag --debug-brk
of nodemon it's necessary to make a breakpoint on the first line. Try modifying the file.js after run the .bat and look the changes reflected on the debugger. This debugger reboots and show the changes done in the file.js. Happy coding JS!!!