Trouble with debug mode. NodeJS
Hello, everyone.
When i'm starting NodeJs app in debug mode nothing happens (i can't connect to the app by renewing http://localhost:myport/ in browser).
After some period of time i got this to the console - "Failed to open socket on port 56981, waiting 1000 ms before retrying".
http://i.prntscr.com/ec64be5da2d74106b5357b8dda3eca98.png
I'm using Linux Mint 17.3
This application works well (debug mode) on my previous HDD, maybe i did something wrong when i reinstalled operating system...
Can anyone help, please?
Please sign in to leave a comment.
From the screenshot is seems that there are several processes sharing the same debug port. Does your application spawn child processes? If the spawned child process uses the same debug port as a parent process, the forked process is suspended and the application 'stalls'.
Hello, Elena. Thank you for your reply. Yes, there are several processes in my app.
The solution for me was to install newer version of NodeJS.
1. When i reinstalled my operating system i did "sudo apt-get install nodejs" and it installed nodejs which version was 0.10.25 and it doesn't work with Webstorm debug. I think in this version was't supported debugging of child processes.
2. I installed nvm, then through this node version manager i installed more newer version of nodejs.
And now everything works fine.
I see, thanks for update:) it's a known Node v < 0.11 issue - the spawned child process use the same debug port as a parent process by default. Not a problem with modern Node.js versions - unless the application is explicitly defined so that the child process inherits parent environment (Grunt is known for such problems, for example)