NodeJS debugging not working in IntelliJ 2020.1
IntelliJ IDEA 2020.1 (Ultimate Edition)
Build #IU-201.6668.121, built on April 8, 2020
Runtime version: 11.0.6+8-b765.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.3.0-46-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 16
Non-Bundled Plugins: net.masterthought.dlanguage, io.protostuff.protostuff-jetbrains-plugin, org.antlr.intellij.plugin, org.jetbrains.plugins.go-template, org.jetbrains.plugins.go, org.intellij.scala, org.jetbrains.plugins.vue, com.intellij.lang.jsgraphql
Current Desktop: GNOME
Debugging of Node.js just seemed to stopped working in Intellij a while ago.
I have the following (example) configuration, using a project created from scratch using the Node.JS project wizard:
When trying to debug the app, IntelliJ starts NodeJS, apparently fails to connect to the debugger and kills the process after a while:
The very same project/configuration works fine in WebStorm (2020.1):
It seems like Intellij fails to set the NODE_OPTIONS environment variable. Unchecking the 'js.debugger.use.node.options' variable in the WebStorm Registry causes it to switch to command line options, but IntelliJ, again, does nothing and fails the same way.
Thing is I could swear this was working like a week ago, but I do not remember whether I updated IntelliJ in the meantime. Anyways, any pointers on how to fix this? Need to use IntelliJ instead of WebStorm since I work with a whole bunch of languages.
Please sign in to leave a comment.
please try uninstalling Go plugin - does the issue persist? Must be https://youtrack.jetbrains.com/issue/WEB-44721
I'm having the exact same problem with 2020.2 (mac 10.15.5, node 12.16.1), uninstalling Go doesn't help
Disabled a bunch of plugins (entire java and android support and a bunch of others) and it started to work. If someone else having this issue I recommend trying to disable all plugins (except js and debugger) and see if this helps, if yes you can binary search the faulty plugin.
I also cannot make the Node debugger work. It correctly connects to the Node process but does not stop on any breakpoint.
Disabling all unused plugins does not solve the problem, unfortunately :(
@... what Node.js version do you use? Please share a screenshot of your Node.js run configuration
Hi Elena,
I use Node v14.4.0.
As I mentioned, the connection to the Node works well. I can see the following:
Debugger listening on ws://127.0.0.1:9229/4f8e91eb-e0b4-45be-9edc-87f72245fd2d
5:15:20 PM web.1 | For help, see: https://nodejs.org/en/docs/inspector
5:15:26 PM web.1 | Debugger attached.
However, IDEA does not stop on breakpoints:
Thanks,
Jacek
Works fine for me
What command do you use to start your app? Why aren't you using the Node.js run configuration for debugging? Also, could you share a test project the issue can be repeated with?
There are many other things going around and starting it through yarn is simpler:
I'm not sure what you are trying to debug and how... No .js files are passed to node in --exec. If I use the similar command, like
nodemon src/app.js -V -e 'js,jsx' --exec node --inspect --require @babel/register
the node args are passed to application, not to node itself, and debugging doesn't work:
[nodemon] starting `node src/app.js --inspect --require @babel/register`
but, if I use
nodemon -V -e 'js,jsx' -x node --inspect-brk --require @babel/register src/app.js
it works as expected - once I attach the debugger, breakpoints in the app are hit
Alright. I got it working after your tips.
Few hints that might help others:
Elena Pogorelova, thank you so much for looking into this. I shared the details, so maybe it will help others and save you some time in the future :)
Cheers,
Jacek
Node.js debug configuration does not hit to breakpoints either with/or w/o Go plugin installed. Here is what I've got in "Process Console|Scripts":
And I do not set any NODE env vars within run configuration or at OS level:
Nodejs debugger does not work even after I disable > 90%% of plugins (including the bundled ones).
I believe that I'm on the latest versions:
Looks similar to https://youtrack.jetbrains.com/issue/WEB-53350 , but it should be fixed in 2021.3.1
Could you check if it works if you downgrade Node.js to v. 16.x or lower?
Thank you, I'll check but I'm on
as it stated on IDEA About info i'v posted in my initial comment. Anyway thank you I definitely try
@Elena Pogorelova As you suggested I downgraded Node version from 17.3 to 16.3 and that works. Hope you guys will fix this soon. Thank you for your help.
For those who, occasionally, trapped into this on OS X:
It fails if node@16 is not installed, so in that case: