No breakpoints with geddy.

I am evaluating the Geddy MVC framework for node.js , and I see a strange problem - none of my breakpoints get caught during debugging.

I am using WebStorm to run node.js in debug mode.

I don’t know how to get Geddy to run in debug mode using the CLI command, so I have a boot file that I use that looks like this:

 console.log("Starting server...") var geddy = require("geddy/bin/cli") console.log("Server started.") 

I set a breakpoint on all three lines and hit only the last console.log , so at least I know that breakpoints and debugging are working correctly.

Geddy internally require() my controllers, which also have breakpoints set in several places. They never hit, but the controllers work correctly, and HTTP requests are also served properly.

Is there a reason why breakpoints won't hit Geddy? Is there anything else I can do?

+6
source share
4 answers

I was not able to verify this, but I believe that the problem is that cluster spawns new processes, but the debugger does not know about them. I did not find a way to bind the debugger to new processes, and I'm not even sure that they can be started with the debug port open.

Geddy uses cluster to inherit this problem.

This topic mentions a possible solution: ( How to enable --debug for node.js when starting GeddyJS ), but this did not help me.

+1
source

There Debug WikiPage with some geddy debug information.

+3
source

Geddy does not currently support debugging, but we would like to add this as a function.

+1
source

To answer a question specifically for Jetbrains WebStorm or IntelliJ (with the Node.js plugin), follow these steps:

In short, configure your application as if you were going to deploy to Heroku or Nodejitsu.

package.json

 { "name": "geddy_todo", "version": "0.0.1", "dependencies": { "geddy": "0.6.x" }, "engines": { "node": "0.8.x", "npm": "1.1.x" } } 

Then you have two options

Option 1: Create an app.js application that starts geddy.

app.js

 var geddy = require('geddy'); geddy.start({ environment: process.env.GEDDY_ENVIRONMENT || 'production' }); 

In WebStorm / IntelliJ, in your Run / Debug configuration for the Node.js application, be sure to add the GEDDY_ENVIRONMENT environment variable and set it to “development” or “test” if you want to run your tests.

Option 2 Call the geddy client directly

@MiguelMadero mentioned this idea in the comments. Install WS / IJ to run the following

 path/to/geddy/bin/cli.js 
+1
source

Source: https://habr.com/ru/post/910097/


All Articles