Webstorm 8 Beta, unable to get a debug session to work
First, I'm running the Windows version of WS.
The problem appears to be that the debugger is not attaching to the plugin in Chrome. I've had it attach occasionally (I can't figure out why it sometimes does or doesn't). When it does, it works just fine. But 99% of the time, it won't attach.
I'm using a debug config in WS that starts Grunt. The application is an Angular app. Not sure if that matters or not, but mentioning it just incase.
Thanks for any help!
请先登录再写评论。
Just a bit more information.
WS is connecting to the plugin, I get this message from within WS under Variables: Connected to 127.0.0.1:51193
The Chrome plugin is "lit up" so it's connected there.
When I said in the first post that the debugger doesn't seem connected most of the time, the difference is, there's usually a popup window that says something like "Jetbrains is current debugging this page" or something like that. When that happens, the debug session works as exepected (my breakpoints are hit). When I don't see that message (which is almost all the time), the breakpoints are never hit.
please attach the screenshots of your run configuration, debug tool window, Chrome instance started
Ok, I have more of this figured out now. Part of it is my own lack of knowledge and part of it is just... weird. =)
I'll attempt to explain things here and hopefully someone can point me in the right direction for a solution.
First, WS is in fact connecting to the debug session.
What is happening is that when I use grunt to start up my app, that opens in a tab, then another tab opens with the debugger linked to WS
You can see here, what I would see when this happens is the Grunt Serve tab is the active one. This is the one that builds my app, fires off karma and then displays in a browser.
Next to it (which I didn't notice before) is the tab that is opened by WS that has the debugger attached.
Knowing this helps a lot, but there are still issues. Overall, this just seems to be a problem with how to setup an environment within WS when using grunt to start up a webserver and debug.
=============
What I've attempted to do now is setup a javascript debug config and a grunt serve config.
The key here is that this runs the Grunt serve config in the before launch.
And here is the grunt serve config:
This seems to ALMOST work. Grunt fires off, does it's thing, when it's done, WS opens the browser and launches the app.
The problem is, it's not connected to the debugger now.
I hope this helps explain things, it's not an easy thing to explain in a forum post, sorry. =)
And yet another update. =)
So when running the configs as mentioned in the last reply, the browser tab that opens is actually from the grunt/karma process, not started by WS.
When I kill the grunt server process, then the new tab opens up from WS with the debugger. However, that can't work as I just closed the web server process from Grunt and it can't serve the browser any files.
I'm pretty sure I'm fundamentally missing something, but... I can't see it. =)
Hello!
just to clarify: are you using Grunt 'server' task to start a static server that serves your static files? And like to debug these files?
Yopur setup looks more or less OK then, but I have no idea why you are running the Grunt run configuration in the before launch. What for?
A single Grunt run configuration with 'Browser/Live Edit' stuff enabled should do the thing
I'm attaching the simple sample (with js/html files served by server created using Grunt connect task). Run the 'Unnamed' Node.js run configuration and, then the page is loaded in the browser, click the 'test' button - breakpoint should be hit
Attachment(s):
gruntServer.zip
Elena,
Thank you for the sample app! Your sample app does in fact function as I would expect. I'm still looking over it, but the only real difference appears to be that I'm using a set of files created through the generator-angular node package (https://www.npmjs.org/package/generator-angular).
So my grunt file is doing a lot of things and I think that's where the problem is. Because it is what is determining what to run and how to live reload files, etc. Since this is the default way to create an angular app, I think many more people are going to run into the same issue soon. So, if you have the time, please check out the above link and see if you get the same issue I'm having in trying to get this to work. I'll keep working on it on my side to try and narrow down things and find a fix as well.
Again, thank you for your help! Hopefully we can get this figured out!
-Troy
Ok, I found what was causing the majority of the problems I was seeing. In the gruntfile.js, find:
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= yeoman.app %>'
]
}
},
and change the value of "open" to false. That'll stop the other page from opening in the browser, the one that doesn't have the jetbrains debugger attached to it.
I'm still seeing some issues with this setup, but looking into them better myself before bothering you here. =) But, if I can't work through them, I'll make another post.
I think we can call this issue fixed at this point though. Thank you again Elena for all of your excellent help!
-Troy