WebStorm node.js debugging not working

env node.js 7.7.1

====

WebStorm 2017.1
Build #WS-171.3780.79, built on March 17, 2017
JRE: 1.8.0_112-release-736-b13 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.3

===

below is my WS JS setup screen.

Here are screenshots for single stepping  (F8) over my code. The code works correctly when run without debugging but I got there by printouts as the WebStorm debugger was no good. The correct execution steps are: 1480, 1486, 1488, 1489 (and may be 1490 and 1492 which are the scope closing braces). Screenshots 1-7) show WebStorm debugger is all over the place and not helpful at all for debugging. The last screenshot (8.png) shows a next API call into this function where it stops on a comment line!


=====1.png

=== 2.png 

=== 3.png

=== 4.png 

=== 5.png 

=== 6.png 

== 7.png 

=== 8.png 














 

 

 

12 comments

please can you elaborate on this issue? Do you change the code, add/remove breakpoint while debugging? Do you use sourcemaps, hot reload, etc? project that can be used to recreate the issue would be helpful

0

I wrote a lot this code yesterday. I added break points at that point. Eventually got it to work by debugging with print statements. This morning I restarted WebStorm and went through a simple debug session to capture screenshots for this post. No new breakpoints added today. It most likely won't happen in a simple project. Not using source maps, hot reload or webpack.  I have been using WebStorm professionally for nearly 2 years and it has happened many times when I wrote new code (say 100 lines or more). It eventually seems to settle/get fixed on its own somehow but its a bummer that its does not work when most needed i.e. getting newly written code to work. I can't share my source code but I can do a interactive screen share session and/or supply any other WebStorm related project files. Let me know what you need in that category.

0

> I have been using WebStorm professionally for nearly 2 years and it has happened many times when I wrote new code (say 100 lines or more). 

 

 Do you use any post-processing (transpiling, bundling, beautifying code, etc., copying it to other fokder)? Do you have any symlinks in your project path?

If the files you change are the ones you debug, and the session (and even the IDE) was restarted after changing the code, it can't be related to adding new code

0

No post processing that I can think of unless some third party is npm module is doing under the hood. We do use newrelicnode.js agent to collect performance stats. Writing  new code is definitely the trigger and if I were to guess it may be adding new code in an existing module. Things seem to be OK in a brand new module but I will have to confirm that after adding another larger new module. Does webstorm keep any debug cache on disk? .idea/workspace.xml seems to have some breakpoint info. How does that work?

0

It seems to work ok for newly created files. Problem seems to be large files with existing code where a few dozen lines of new code has been added in new functions etc. 

0

>Does webstorm keep any debug cache on disk? 

No, nothing

>.idea/workspace.xml seems to have some breakpoint info. How does that work?

 

it just stores the file URL and line number, plus breakpoint properties (enabled/disabled, condition, etc.). Like:

<line-breakpoint enabled="true" type="javascript">
          <condition expression="flag" language="JavaScript" />
          <url>file://$PROJECT_DIR$/app.js</url>
          <line>15</line>
          <properties />
 </line-breakpoint>

0

This seems to be a problem. It seems after a few Javascript Debug sessions, a temporary read only version of my file is opened. Once that temp file shows up, i can't seem to get my changes to get bebugged.

Closing PhpStorm and reopening seems to work one time until I add more code.

This is a bug that needs fixing. Not debugging JS is have the reason I pay for the IDE.

0

I should Note - even after I close PhpStorm and reopen, the file name of the read only file that the debugger uses is the same. Seems like a temp file or cache somewhere.

0

>This seems to be a problem. 

What? Storing file URL and line number in workspace.xml? No. I can't imagine how this can be related to your issue

 

>It seems after a few Javascript Debug sessions, a temporary read only version of my file is opened.

these read-only file is likely a runtime version of your file. If the file that is being executed can't be mapped to source file for some reason (no sourcemaps found, no local version of the file exists because the code is generated dynamically from eval(), for example, etc), the read-only tab is opened on stepping into the code

 

0

I don't know what workspace.xml has to do with the issue. I am just reporting that javascript debugging is not working, is using some sort  read only file, and that file does not update.

 

PhpStorm 2017.1.3
Build #PS-171.4424.11, built on April 26, 2017
Licensed to Dave Ferrara
Subscription is active until May 19, 2017
JRE: 1.8.0_112-release-736-b21 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.4

0

>I don't know what workspace.xml has to do with the issue

what's the reason for replying to my comment about workspace.xml then? If your issue has nothing in common with the one being discussed in the thread, please don't pollute it with unrelated comments, create a new thread instead.

 

0

I had the same issue using build #WS-173.4548.30.  I fixed it by deleting my .idea directory and recreating my configuration from within Webstorm.

 

0

Please sign in to leave a comment.