If you have your Node running
node --debug server.js
This gives me a port number xxxx, should I use this port number when starting Chrome?
Do you remote debug into it from
Google\ Chrome --remote-debugging-port=xxxx?
Or is the 9222 a magic port, as it is mentioned all over.
Am I on the right track, trying to start Chrome with
--remote-debugger into the Node.js
The node-inspector / –debug are now replaced by inspector
See update below
#now deprecated / see below for update #install node-inspector npm install -g node-inspector #start node-inspector, listen on port 8080 (default) node-inspector --web-port=8080 #in another terminal session/window: #while node-inspector is running, start your project in debug mode node --debug myproject.js
Now you can browse to http://your_server:8080 for a full debug session of myproject.js
If your remote server is not accessible on the remote port because of firewalls or other reasons, you could create an ssh-tunnel to it from port 8080 on your local machine to ‘localhost:8080’ on the remote server:
ssh -L 8080:localhost:8080 [email protected] -N
and keep this running while you use http://localhost:8080 on your local machine to debug your remote nodejs session
Update august 2017
Start node in inspect mode:
node --inspect=0.0.0.0:9229 myproject.js
or if you want the debugger to break at the first line of myproject.js:
node --inspect-brk=0.0.0.0:9229 myproject.js
Then open the following URL in your chrome browser:
Click the ‘Configure…’ button and add the following target:
After you click the ‘Done’ button, you should see myproject.js under your remote targets. Click the inspect link to start debugging. Unfortunately, the inspect link does not work on Chrome 58 for Ubuntu. It works fine on Chrome 60 for Windows.
node-inspector to remotely debug your node application from Chrome that you’ve started with the
--debug option as you’ve shown.
Recent versions of Node (> v6.3.0) and Chrome now allow you to use the Chrome Developer Tools to debug a Node.JS process without having to install anything else. Just pass
$ node --inspect script.js Debugger listening on port 9229. Warning: This is an experimental feature and could change at any time. To start debugging, open the following URL in Chrome: chrome-devtools://SOME-URL-HERE
Just open that URL in Chrome, and you’re good to go.
If you need to pause your script immediately after Node starts, you can also pass
--debug-brk in the same command.
$ vagrant ssh — -L 5858:127.0.0.1:5858
to ssh connect to VM. also this comment would start a proxy server on port 5858;
you could test using telnet 127.0.0.1 5858 to see if local proxy server started or not.
In VM, you can start node with command
$ node –debug-brk app.js
- set up debug configuration in web storm.
- when you start debug in web storm, node.js server in VM will start in a few seconds.
PS: there is no need to touch the vagrant file.
Reference: Connecting WebStorm to a remote node.js debugging session.