Debugging nodeJS in node-inspector

heroku
nodejs

#1

I am trying to debug my server side Node JS code in Cloud9. I’m following the steps here: http://debugfix.com/2012/03/debug-node-js-apps-node-inspector/

I run into a problem when I try to connect to http://127.0.0.1:8080/debug?port=5858 in my web browser. It connects my computer’s localhost instead of the Cloud9 localhost.

How can I launch a website inside Cloud9 to connect to localhost?


#2

localhost = your computer

You have to find the URL of your workspace and use it. Please read this.


#3

I made some progress but not fully solved.

In my Procfile I put:
web: node --debug=8082 app.js

My log showed:
Debugger listening on port 8082

I started node-inspector in bash with:
node-inspector --web-port=$PORT --web-host=$IP --debug-port=8082

I was able to load the node-inspector interface at when I went to the following address in Chrome:
http://workspace-username.c9users.io:8080/?port=8082

But nothing appeared in the node-inspector. There were no sources. Any ideas? After a few seconds, the node-inspector windows give the error:
Detached from the target. Reason: websocket_closed


#4

Hey, did you find an answer to this?


#5

I never fully got it working. I think I was pretty close with my last message above. Please share if you solve it.


#6

I am having this same problem.
My node application server is hogging $IP and $PORT because that’s what C9 wants.
The app is sicko, and needs a deep inspection. The debugger needs a second port because 8080 is taken.

How can I either use the internal debugger, or open a port or whatever node-inspector needs?