0

I installed node-inspector.

I run it: node-debug app.js

But it opens the empty browser.

If I try to run node.js in debug mode before: node --debug app.js

It kind opens my scripts in browser.

But it's still not clear how to make it work. What to do next? Which url to use to see the working app itself in browser and trigger app to go to breakpoints?

My express app is usually running under localhost:3000. Should I run this url? It's not working.

Thanks

1

1 Answer 1

0

Okay, I was able to figure it out. The problem was my app is Express based and it's a little bit different. For some reason it's not easy to find these differences until you start digging into every details. There is the instructions how to run debugger if you app is working under Express. Prerequisites:

  • Windows 7
  • node.js app based on Express

Now:

Step 1. Run app in the debug mode (staying in the folder where your app.js located in the first command prompt), do either of 2: node --debug app.js or node --debug bin/www.

Step 2. Open the second command prompt and run node-inspector bin/www (or node-inspector app.js)

If you see the error that it can't access port 8080 it means that something is already listening to it. So you need to run this command differently: node-inspector --web-port=8099 bin/www

After step 1 you will able to run your app as usually in browser: localhost:3000.

After step 2 you open another browser window and enter: http://127.0.0.1:8099/?port=5858

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.