Debugging meteor app - setup node inspector - node.js

I wanted to debug meteor code and came across couple of links:
How to debug server side code in a Meteor app
https://github.com/oortcloud/unofficial-meteor-faq#how-do-i-debug-my-meteor-app
While these two links talks about using node inspector to debug the code, it does not tells you how to run the actual application and setup the break point.
I am able to run\setup node inspector but I am not sure after that how can I launch the application and set breakpoints. Please help

Related

Debugging not working in Intellij - NodeJS + NestJS App

I am trying to debug a nodejs + nest application in IntelliJ, I am able to start the application using two types of configs.
Using Yarn (through NPM configuration template in intellij)
Using Node (I am not sure but when I use the main.js from dist folder then I get some debug point but it is useless as it is not pointing to my actual code base)
Debugger doesn't work for any of the above options!
I am posting screen shots of both the configurations.
New to Node + IntelliJ, so not sure what did I do wrong in both the configurations! Any help would be appreciated.
Intellij Version is 2020.3.3 And NodeJS application exposes several APIs, I am trying to call the APIs using a Postman and expect it to debug.
Debugging in both main.ts and controllers works for me when using the configuration below:
See also https://github.com/nestjs/nest/issues/993 for some recipes

Debugging Selenium JS application on NodeJS

Im NodeJS newbie. I have JS application for running selenium-based tests of web aplication. My problem is that I cannot debug this application.
How to debug my JS application. My editor is Visual Studio :) or any simple text editor.
My application is started by code
node src/test/UI/app/Tests.js
Any module needed for debuging JS apps started under NodeJS?
As an example, you can debug your Node.js in WebStorm.
There are two scenarios of how you can do that.
Remote debugging. In that case you need to run you test with --inspect flag (node --inspect <pathToTest>). Then you need to create a debug configuration (port 9229 is a default debugging port used by Node.js). See details on the screenshot bellow.
Start Node.js app through WebStorm debug configuration. In that case you just have to specify another debug configuration by setting path to node binary and specifying application entry point (in that case it is your test file). Screenshot bellow illustrates details.
After that set a break point and launch your selenium test.
Happy debugging.

Debug node.js web application that has been launched via a Gulp task

I have a web application that is written in node.js and gets started using a gulp command. When the application first starts, before the server is running, debug points may be hit in WebStorm (or in any IDE or command line tool). However, after the server is running and I go to the interface in my localhost I can no longer hit debug points inside the application. This is not being caused by client side code as the debug points are in server code.
I have read the answers that involve using the node-inspector and that has not solved my problem because of configuration files that are not getting read when starting the debugger in node inspector.
I'm a bit surprised that there is so little on here about this issue. Is it not a normal problem that other developers face? Thanks in advance for the help.
My workaround for this may not be sufficient for every case. I was modifying JavaScript files and didn't actually need the configuration files, after loading, to be able to test my changes. I did the following:
Wrote a line in my app.js file that set the variables I needed. (these would have been tasks ran in Gulp)
I then started the app as a Node.js app and was able to debug it as normal.
If any of my views had been updated, or anything else that was being managed by Gulp, then I could have simply stopped the server, started it again via the Gulp command, and then stopped again and restarted as a Node.js app.
This did not solve the issue in my OP but it was a good enough workaround to get debug points in the JavaScript.

node-inspector not working from generator-angular-fullstack app

I'm pretty new to grunt, and created a new app using generator-angular-fullstack and yeoman. I'm trying to figure out how to debug.
When I run grunt serve:debug, I get a Chrome window with http://localhost:8080/debug?port=5858
I then open my application at http://localhost:9000 in another Chrome tab.
Two issues though:
If I set a break point, the debugger never hits it
I can only set breakpoints in client side js, not server side
Thanks for any help

How to debug Node.js based web application

I have been seeking solutions for debugging Node.js based web application from days. I had tried to debug with Eclipse + Chrome debugger plugin but failed, I posted the error in this session 'Failed to get tabs for debugging' when trying to debug NodeJs with chrome debugger for Eclipse, but could not find an answer.
However, as Node.js is so popular, I have no doubt that a lot developers have the solution for debugging Node.js server JavaScript code. I appretiate if you could share me your solution of setting up an IDE (edit and debug) for Node.js server JavaScript code, or at least how to debug it.
I would suggest using node-inspector. Here is a good tutorial for setting it up. It allows you to use a browser tab to look at your code, set breakpoints, and step through it. Additionally, you can start node with the flag --debug-brk and it will insert a break point on the first line, if you need to debug something that happens on startup.
There are several tools to debug a node application. A great ressource has been postet on Github recently.
A simple debugging setup might be just adding a breakpoint to your code and start node in debug mode like this:
Example code with use of debugger, a manual breakpoint.
app.get('/foo', function(req, res) {
var something = 123;
debugger; // execution stops if this point is reached
foo(something);
});
Start node in debug mode:
$ node debug app.js
Once you started the application in debug mode you use the application (e.g., navigate to the ressource with your browser) and once a breakpoint occurs, the execution stops and you have a debugger environment in your terminal.
Try to use Weinre (WEb INspector REmote). It's a node app help you debug UI, log for web app on devices.
It hope it can help you.

Resources