I am having a strange issue debugging node.js apps in WebStorm 7.
The first time I start the debugger I get the application running:
/usr/bin/node --debug-brk=34041 app.js
debugger listening on port 34041
Current Environment: development
Express server listening on port 3000
But, after the first time (or if I restart the debugger), I get the debugger running but not the app, like below:
/usr/bin/node --debug-brk=42140 app.js
debugger listening on port 42140
or
/usr/bin/node --debug-brk=51341 app.js
debugger listening on port 51341
I need to restart the WebStorm itself in order to debug the app again.
Is it a bug in WebStorm?
Is it a bug in Node.js?
Is there a way to make it work properly?
After contacting the support, I found that it was a bug in the WebStorm, already fixed in version 7.0.1.
Related
I am currently debugging pure js Nodejs apps remotely over SSL using port mapping.
On the Linux server side I run balance -df 8585 127.0.0.1:5858 to port map 8585 to 5858 and it works great with remote debugging and WebStorm.
so on server I run node --debug-brk --nolazy ./someFile.js
and put a breakpoint on Windows in WebStorm and all is great!
Now I would like to remote debug TypeScript files on server side instead of JS.
Is there any tutorial on that? Do I need to compiles to JS file every time on server side and where should I keep the sourceMap on Windows side where I put the breakpoints or on server side? How about the tsconfig?
I started the debugger using :
$ node --inspect ../cadence-web/server/routes.js
Debugger listening on ws://127.0.0.1:9229/e470a53c-480b-497e-8494-5f1ea62f3b38
Now - I inspect chrome: The code is successfully opened in the debugger.
Please see link below
I open dedicated devTools for Node
Please see link below
I go to localhost:9229: The site cannot be reached.
Any help will be appreciated.
What am I doing incorrectly. Why is the code not loaded on localhost: 9229
The port mentioned in the startup is the Debugger port where the Debugger (Web Tools or VSCode etc.) listens to node. It is not the port your web server is using. That port hasn't changed from its setting in code. Check your source, it should be there, something like 3000 or 8080, depending on your framework and settings
When I run nodemon dist/server/app.js it works on default port 3000 and I'm able to reach my API. But if I run
nodemon --inspect-brk=localhost:3000 dist/server/app.js
I got error
WebSockets request was expected
What's wrong?
You can't run your web server and the debugger on the same port. They are each separate servers (the debugger is a server built into the node.js runtime).
So, you can either remove the port and host designation from the --inspect-brk option and just let it use the defaults (which is all I ever use) or you can select a different port for the debugger that doesn't conflict with your web server or anything else running on that host.
I have installed Node.js on my web server plus the dependencies for Express. When I run the command npm start and go to my web site's address using the port 3000 (which I believe the app is set to by default?), it just keeps loading and never loads. Any tipps please on how to fix this?
Try this $ PORT=8080 node app.js. Here app.js is your server config file. I suspect some background servers are running in that port 3000.
I have tried launching node-inspector using:
node-inspector
node-inspector &
I have tried launching my app using:
node --debug ./bin/www
node --debug-brk ./bin/www
I am running the app from a vagrant box from which I have used port forwarding for the port 3000 and running the node-inspector on my windows PC.I have tried disabling all my Chrome extensions,I have tried removing and reinstalling node-inspector as well.I have tried adding debugger messages to my files.
I always get this window when I open node-inspector,it does not load any of the applications files for me to set breakpoints.Here is a screenshot of node-inspector.
I have also tried disabling my antivirus(Avast) and that does not work,I have tried forwarding the port 5858.
I have tried starting the default debugger,it just says connecting...:
node debug localhost:5858
How can I understand what the problem is and how can I solve it?
You need to forward port 5858 as well from your vagrant box to pc. Alternatively, start node-inspector inside vagrant and forward its web port ( 8080 by default )