How to run and debug an AngularJS application in Eclipse? - javascript

I'm trying to get started with Nodeclipse. I would like to run and debug an AngularJS application, e.g. the angular-phonecat example from Eclipse.
In particular, I would like to
use a Debug on Server launcher to start a server with my application and open a web browser (Firefox or Chromium).
set a breakpoint in a JavaScript file in Eclipse
click around in the web browser and have the Eclipse debugger stop at the breakpoint.
(The equivalent of this does work in NetBeans in a very intuitive way.)
From the Nodeclipse help, I don't see how to get started or whether this is possible at all.
I managed to run an debug a Node.js project with the Hello World template, but I don't see how to debug anything running in a web browser.
Does that require a Remote Javascript debug launcher? If so, how to use it?
Finally, I don't see how to actually run an AngularJS application in Nodeclipse. As far as I can tell, the AngularJS Eclipse plugin only implements editing features but does not deal with running and debugging. Do I need to turn the Angular project into a Node.js application? If so, how?

AngularJS runs in browser, Node.js on server,
so you need different approaches.
Nodeclipse is primarily about supporting Node.js and has ChromeDevTools-based debugger. I cannot tell what is best for debugging browser JavaScript, maybe it is Chrome browser.
managed to run an debug a Node.js project with the Hello World template, but I don't see how to debug anything running in a web browser.
Ask on https://github.com/angelozerr/angularjs-eclipse/
Do I need to turn the Angular project into a Node.js application?
For Node.js run/debug it is not needed.

Related

Accessing javascript functions on running Node application

I'm trying to setup a new node application server and I'm finding it frustrating to debug on. Previously I have mainly worked on web based applications/ chrome extensions and I could easily execute javascript functions, api's and access variables from chrome dev tools.
I have tried --inspect and --inspect-brk coupled with Visual Studio Code and also mapping to chrome://inspect/#devices but to no avail; to make matters worse my node code is remote. Can anyone provide any pointers?

Debugging JavaScript with Flask and PyCharm

I just installed the professional version of PyCharm for its Flask features, but I'm having a lot of issues getting anything JavaScript related working.
Firstly, is there any way of getting the browser to open when you run the flask project? There doesn't seem to be a Flask run configuration, which means you have to use the default Python configuration, and that doesn't have the option to run a browser. I tried making a JavaScript Debug project that runs the server as a Before Launch command, but it still doesn't open the browser (either Chrome or Firefox)
Secondly, how do I get PyCharm to hit the JavaScript breakpoints? Even if I manually browse to the flask server (http://localhost:5555/), Intellij doesn't hit breakpoints in my JavaScript, even though the JetBrains plugin is installed (again, in both Firefox and Chrome). I suspect this may be related to the fact that PyCharm doesn't open the browser, which is why I mentioned that as my first point.
Can anyone with experience in PyCharm or IntelliJ help me out?
Just solved this problem.
You need some setup steps.
My prerequisites:
PyCharm on my local laptop
I'm developing on remote virtual machine (droplet DO, Ubuntu)
Setup you web-server. It should be Apache, nginx whatever.
Setup you web-app. You web-app should be runned on web-server.
Setup your debug configuration:
a. Run->Edit configuration
b. Add->JavaScript debug
c. Specify you URL as real url from web-browser like:
http://YOUR_IP:YOUR_PORT/directory/category
d. Specify File/Directory of HTML template and remote URL where your template located.
e. Debug it.
f. Profit ! :)
P.S. So lovely evaluate JavaScript variables from familiar PyCharm tool :)
P.S2: Almost forgot: Need install Chrome extension: https://www.jetbrains.com/help/pycharm/2016.3/debugging-javascript.html#d615717e345

Meteor.js - can I drop into a Meteor shell to try out some JavaScript in my Meteor environment?

I often develop in Python and sometimes find it useful to type python at the terminal prompt and drop into a Python shell where I can import various modules and test some behavior. Node.js has similar functionality if I type node at the command line.
I'd like to do the same now that I'm developing with Meteor. How can I get to a shell prompt where all the packages I have added with meteor add are loaded and ready for me to play with?
Just install node-inspector and then you can easily use the node-debug command to run node-debug mrt. That should open a debugger console.
You can then just drop a debugger; keyword onto a line anywhere in your code to drop into a REPL like setting.
As of recently, meteor shell will give you a REPL into the server process.
Of course, you know this #JoshOwens, I think I heard about this on your podcast :)
Node.js and python are both interpreters.
Meteor is a application framework build upon node.js. So testing out code in the way you mentioned is impossible.
You can however use the chrome debugging tools to run client side code within your meteor application.
Executing server side code to see what it does is a bit harder but also not impossible. Best way would probaply to setup nodejs remote debugging and using the debugger. See: Meteor debugging setup

debug Grails app's JavaScript from IntelliJ

I use IntelliJ to develop Grails apps and when testing locally, I usually launch the app from IntelliJ which runs the app in an embedded Tomcat server. IntelliJ provides JavaScript debugging, but until now I've always used Firebug, but the idea of being able to use IntelliJ for all my debugging is pretty appealing.
I tried setting a breakpoint in IntelliJ and lauching the app in debug mode from inside IntelliJ, but the breakpoint was ignored. I also tried launching the app from outside IntelliJ via grails-debug run-app, then connecting to it with a remote JVM debugger, but the breakpoint was still ignored. Does someone know how I can debug JavaScript of a Grails app launched from IntelliJ?
I'm using IntelliJ Ultimate Edition version 13
Actually you need to do some extra work for debugging JavaScript with IntelliJ. Here are some useful articles about how you can configure your IDE and browser for JS debugging.
http://blog.jetbrains.com/idea/2011/03/intellij-idea-debugging-javascript-in-google-chrome/
http://wiki.jetbrains.net/intellij/Debugging_JavaScript_with_IntelliJ_IDEA
After configuration you need to just run your Grails application in debug mode.

How to debug Meteor in IntelliJ

I want to debug javascript code of Meteor apps in IntelliJ.
I read the instructions in the following tutorials:
http://www.jetbrains.com/idea/webhelp/running-and-debugging-node-js.html
http://wiki.jetbrains.net/intellij/Remote_JavaScript_debugging_with_WebStorm_and_PHPStorm
The first tutorial explains debugging a Node.js application. The second tutorial explains debugging a javascript application.
Could someone explain how to debug meteor apps in Intellij?
there is an instruction here (please add your vote) but the issue is you need to restart the debugger every time you make a change because meteor restarts the nodejs process.
starting your application with ´NODE_OPTION="--debug"´ allows you to debug in ´node-inspector´ with the same limitation (restart after every change). instructions here
My experience with IntelliJ is that even if restarted every time, the javascript debugger will struggle to reconnect. I use IntelliJ for development but node-inspector for debugging.

Categories