<urgent> Facing issue while trying to setup Express Node js framework with Intellij Idea

I have already set up my server address(local host) in  /etc/hosts file (example localhost : abc.xyz.prq). 

Then try to run npm start command to start the nodejs server.

Do I need to setup debugger for node.js in local mode since I have already setup server address using etc host file ? or Setup it remotely.

If you have any link / vide how to debug it would be great .

Thanks alot.

4 comments
Comment actions Permalink
Official comment

If you're running your Node.js application on your local machine, you can configure Node.js run configuration. In this case, you don't need to setup debugger, it's configured automatically for locally running applications (via Node.js run configurations).

If you stumble upon an issue related to "/etc/hosts" file modification, please provide more details about the problem here. As a workaround, you can debug your Node.js application in two steps:

* Run your Node.js application using Node.js run configuration (specify `--debug-brk=<debug port>` in "Node parameters" field)

* Create "Node.js Remote Debug" run configuration, set "Host" to the needed IP and "Port" to the specified debug port from the previous step. Then, debug this "Node.js Remote Debug" run configuration.

Comment actions Permalink

@Sergey Thanks for reply still I am facing issue while setup my IntelliJ with node.js.

Still debugger is not able to stop at break points but I am able to get the log displayed in console window.

JavaScript Debug is working fine .

I don't know intelliJ issue or my setup issue.

Let try to explain the problem.

1) Initially I edited the /etc/hosts file with localhost address and website name, so that whenever  I click on my chrome browser, I can open it with  mywebsite.com  instead of localhost IP address.

2) When ever I tried to give command node npm start my website is up and start working and for debuging uses various tools like chrome,inspector,etc .

3) Now I thought debugging can be easy if I use it using IntelliJ Idea, but I tried add the debugger but it fails at node.js part but javascript debug part was working fine.

4) So what setting I have given on IntelliJ

    1) I install npm 

    2) I worked with both i) Local setup - NodeInterpreter : /usr/local/bin/node , working directory - mywebsite folder path, Javascrip file : server.js (Listen at 80 port mentioned in js file), Brower (check the box) | also mention URL http://mywebsite.com  . ii) Remote setup - mentioned Port 80 and http://mywebsite.com only.

3) setting at javascript debug : URL http://mywebsite.com. This will work.and able to setup debug point.

If you have any suggestion please guide me.

0
Comment actions Permalink

It's hard to suggest something now.

Could you please attach a screenshot of the configured run configuration you tried to debug? Both  "Local setup" and "Remote setup", please.

0

Please sign in to leave a comment.