Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to debug Node.js application in IntelliJ or WebStorm

I see a lot of posts how to debug posts and talks on how debug node application and they mostly points to vs code and other command line tools.

As a fan of IntelliJ and WebStorm IDE, is anything I am missing which can save my day while debugging my Node.js application?

like image 358
Aniruddha Das Avatar asked Feb 16 '17 13:02

Aniruddha Das


People also ask

How do I debug Nodejs in IntelliJ?

To start debugging, hold Ctrl+Shift and click the link. IntelliJ IDEA starts a debugging session with an automatically generated Attach to Node. js/Chrome configuration.

Does WebStorm support Nodejs?

WebStorm lets you run and debug Node. js applications using Node. js on Windows Subsystem for Linux. You can choose Node.

How do I debug a node JS application?

Open the starting file (typically index. js ), activate the Run and Debug pane, and click the Run and Debug Node. js (F5) button. The debugging screen is similar to Chrome DevTools with a Variables, Watch, Call stack, Loaded scripts, and Breakpoints list.

Which tools can be used to debug Node JS application?

Thus, you can use built-in Node. js debugger to debug your Node. js application.


2 Answers

Please see https://blog.jetbrains.com/webstorm/2014/05/guide-to-node-js-development-with-webstorm/ - this post is not new, but still relevant

like image 74
lena Avatar answered Oct 17 '22 22:10

lena


Jetbrains has a write up of how to debug Node.js applications that is a good starting point:

https://www.jetbrains.com/help/idea/running-and-debugging-node-js.html

The biggest issue that I've run into is that none of the provided solutions automatically restart your application when changes are made. I've worked around this by using their remote debug functionality and attaching to a server running with nodemon. However, I still have to manually restart the remote debug job in IntelliJ as it does not automatically reconnect when the remote debug server restarts.

There is an open YouTrack request to add this functionality, but Jetbrain's recommendation is to instead use their Live Edit functionality.

Live Edit is bundled by default with Webstorm, but has to be installed on IntelliJ Ultimate. I have not tried using Live Edit with a Node.js application, but their documentation says that it should work.

like image 36
Sean Ray Avatar answered Oct 17 '22 23:10

Sean Ray