-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Debugging with webstorm doesn't stop of breakpoints #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is a good question. I'd like to do this as well, however I've only been able to get webstorm to debug when it's running the server itself. But then you don't have use of the other grunt tasks, like watchers. This shouldn't be a problem with the generator, however it may be a problem related to grunt and or the grunt-express-server. Maybe someone who has had a bit more experience with webstorm can help figure this out. |
Thanks. Its nice to know its not just me. Can I propose we leave this open to see if anyone else has a work around. It would be really nice if we could do it. |
I am able to enable debugging of server-side code served by express by setting debug to true in gruntfile.js:
|
Yeah, that's exactly what #32 does. |
That's fantastic! Works like a charm. Thanks for the pull request. While we're on the subject, is there a way to get webstorms debugger working for client javascript as well? Still seems to ignore those breakpoints. |
I don't actually use WebStorm much anymore, so I'm not sure. It might be possible with Chrome DevTools Remote debugging? But that limits your debugging to Chrome. |
I've figured out how to get it debugging in webstorm on the client as well. Instructions are here http://www.jetbrains.com/webstorm/webhelp/debugging-javascript.html Basically you just add a run configuration for javascript debug and set the url to localhost:9000, or whatever port you're using. The critical step I was missing was that you must then map the app/scripts folder to http://localhost:9000/scripts in the configuration. Then just run it alongside your server debug and you've got debugging fully enabled! |
Nice work guys! thanks for all the hard work. With regards to client side debugging, i have always used chrome dev tools, but maybe i will take a look at webstorm. Just out of interest whats the best way of applying this patch to my already installed generator? Of course I do see its only one line change so I could make this change manual but was wondering what the standard way of patching an already installed generator until a new release is released via bower (for example) I presume i need to do a git pull onto the directory where the generator is installed (under my appdata/roaming)?? Thanks again. |
One relatively easy way would be uninstall generator-angular-fullstack from npm, clone the repository somewhere, then type npm link from the folder. This way you can make whatever edits to the generator you want, in addition to pulling any new commits. |
Nice. Thanks. |
Very nice 👍 Some of us are using WebStorm, so that will come in handy. |
I have the same issue... I have the last version of the generator (with debug set to true in gruntfile.js) and WebStorm 8 EAP. Extract of the first tab output: "C:\Program Files (x86)\JetBrains\WebStorm 134.1081\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --debug-brk=22636 --nolazy C:\Users\Chris\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt serve debugger listening on port 22636 Running "serve" task ... Running "express:dev" (express) task Starting background Express server debugger listening on port 5858 info: socket.io started Running "open:server" (open) task Running "watch" task Express server listening on port 9000 in development mode GET / 500 6ms - 1.4kb db connection open finished populating things finished populating users |
@jitowix Did you follow the instructions as explained in #32? It works for me. Also if remote debugging doesn't work for you, you could add a node configuration to webstorm that launches the server.js, and run that in debug mode. |
@DaftMonk Thanks for your reply. Unfortunately the only way I've been able to make the debugging working is by running "grunt serve" from the terminal and creating a remote debug task in WebStrom. (which is not really handy) Launching grunt from a task is still not working properly (breakpoints not hit)... Here is my config: I've tried with WebStrom 7 and other apps and I've the same issue. I'd appreciate any help. |
Well using grunt-express instead of grunt-express-server seems to have fixed my issue. No needs to attach any remote debugger with this one. |
Glad to see you were able to resolve it. Would you mind posting your grunt configuration? I might want to try that out. |
Spoke too soon. grunt-express isn't exactly what I need. |
@jitowix Does it work if you run just |
@jitowix Sorry, just re-read your issue. That works fine, the problem is running from within WebStorm. |
@jeef3 Indeed, thanks anyway... I also tried on Ubuntu, same issue. |
@jitowix Sorry, I understand your frustration. I run grunt serve as an external tool, configured like this Then I run the debug configuration in #32 separately. Because this is debugging using the standard --debug paramater, I can only effectively set break points on code that I can trigger after the server has started up, like api routes. Alternatively, setting up a node configuration within webstorm and running it in debug mode allows you to set break points anywhere, because it runs the process with --debug-brk. Unfortunately, you can't run any grunt tasks when debugging this way. I'm looking at using grunt-nodemon, instead of grunt-express-server, because it allows you to use --debug-brk when launching the node process. |
Thanks very much for sharing your config, really appreciate it. However the breakpoints issue seems to have been fixed in WebStorm 8 :) |
That's awesome, I'm looking forward to upgrading. :) |
DaftMonk, I'm using the Grunt integrated in WebStorm. You dont need configure it in external tools. |
@thiagohac Nice trick but manually restarting the Node.js remote debugger every time the server restarts is a bit annoying. |
My way is delete the sub-target "concurrent:debug" of task "serve:debug"(I made another target named "debug-pre"). I'm so confused before understanding Grunt and tasks in Gruntfile. |
Has anyone found a solution to using WS's grunt, without restarting the debugger each time the server restarts? |
Hi there,
Great generator! I found a small problem, it may not be associated with the generator but according to stackexchange I have setup the correct way of debugging a node.js controlled by grunt. I thought I may put my findings here, maybe somebody else is experiencing same issue or has a fix, or is it a known problem ?
I don't need debugging when developing angularjs but i have found i do need it when developing the backend part (express.js / node.js)
I am lost :-)
I setup debugging via this
http://stackoverflow.com/questions/17043484/grunt-debugging-from-webstorm?rq=1
Here is the output from webstorm, it takes a while for the browser to launch but eventually it launches and everything seems ok and I am able to view the site here http://localhost:9000/
But i have added breakpoints to controllers, server.js etc and nothing is hit.
Its a little suspect as I get "ReferenceError: Process is not defined" below but running from the the command line direct doesn't cause this problem.
"C:\Program Files\nodejs\node.exe" --debug-brk=61951 C:\Users\gregsoni\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt serve
debugger listening on port 61951
[ReferenceError: process is not defined]
Running "serve" task
[ReferenceError: process is not defined]
[ReferenceError: process is not defined]
Running "clean:server" (clean) task
Cleaning .tmp...OK
Running "concurrent:server" (concurrent) task
[ReferenceError: process is not defined]
[ReferenceError: process is not defined]
[ReferenceError: process is not defined]
[ReferenceError: process is not defined]
[ReferenceError: process is not defined]
[ReferenceError: process is not defined]
Running "copy:styles" (copy) task
Done, without errors.
Running "compass:server" (compass) task
directory .tmp/styles/
create .tmp/styles/main.css (1.237s)
Compilation took 1.239s
Done, without errors.
Running "autoprefixer:dist" (autoprefixer) task
Prefixed file ".tmp/styles/main.css" created.
Running "express:dev" (express) task
Starting background Express server
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
Express server listening on port 9000 in development mode
Running "open:server" (open) task
Successfully connected to: mongodb://localhost/test
finished populating things
Running "watch" task
Waiting...GET / 304 10ms
GET /partials/main 304 2ms
GET /api/awesomeThings 200 8ms - 1.03kb
The text was updated successfully, but these errors were encountered: