Geddy没有破坏点

时间:2023-01-18 11:24:09

Im evaluating the Geddy MVC framework for node.js and I am seeing a strange issue - none of my breakpoints get hit when debugging.

我正在为node.js评估Geddy MVC框架,我看到一个奇怪的问题 - 我的断点在调试时都没有被击中。

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

我正在使用WebStorm以调试模式启动node.js.

I dont know how to make Geddy start in debug mode using the CLI command so I have a bootstrapper file that I use that looks like this:

我不知道如何使用CLI命令让Geddy以调试模式启动,所以我使用的bootstrapper文件如下所示:

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

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

我在所有三行上都设置了一个断点,只有最后一个console.log被命中,所以至少我知道断点和调试工作正常。

Geddy internally require()'s my controllers who also have breakpoints set in several locations. These never get hit, but the controllers do work properly and the HTTP requests are served properly as well.

Geddy内部要求()我的控制器,他们也在几个地方设置了断点。这些永远不会受到影响,但控制器可以正常工作,并且HTTP请求也可以正常提供。

Is there any reason why breakpoints will not be hit in Geddy? Is there something more I can do?

有没有理由为什么断点不会被Geddy击中?还有什么我可以做的吗?

4 个解决方案

#1


3  

There's a Debugging WikiPage with some information about how to debug geddy.

有一个Debugging WikiPage,其中包含有关如何调试geddy的一些信息。

#2


1  

I have been unable to verify this, but I believe the issue is due to the fact that cluster spawns new processes but the debugger is unaware of them. I have not found a way to attach the debugger to the new processes, and im not even sure if they can be started with the debugging port open.

我一直无法验证这一点,但我认为问题是由于集群产生了新进程,但调试器没有意识到它们。我还没有找到一种方法将调试器连接到新进程,我甚至不确定它们是否可以在打开调试端口的情况下启动。

Geddy uses cluster so it inherits this issue.

Geddy使用集群,因此它继承了这个问题。

This thread mentions a possible solution: ( How do I enable --debug for node.js when running GeddyJS ) but this did not help me.

这个主题提到了一个可能的解决方案:(如何在运行GeddyJS时为node.js启用--debug),但这对我没有帮助。

#3


1  

Geddy doesn't currently support debugging, but we'd love to add that as a feature.

Geddy目前不支持调试,但我们希望将其添加为功能。

#4


1  

To answer the question specifically for Jetbrains WebStorm or IntelliJ (with the Node.js plugin) debugging:

要专门回答Jetbrains WebStorm或IntelliJ(带有Node.js插件)调试的问题:

In short, set up your app as if you were going to deploy on Heroku or Nodejitsu.

简而言之,设置您的应用程序就像您要在Heroku或Nodejitsu上部署一样。

package.json

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

Next you have two options

接下来你有两个选择

Option 1. Create an app.js that runs geddy.

选项1.创建运行geddy的app.js.

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 app be sure to add an the environment variable GEDDY_ENVIRONMENT and set it to 'development' or 'test' if you want to run your tests.

在WebStorm / IntelliJ中,在Node.js应用程序的运行/调试配置中,如果要运行测试,请务必添加环境变量GEDDY_ENVIRONMENT并将其设置为“development”或“test”。

Option 2 Invoke the geddy client directly

选项2直接调用geddy客户端

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

@MiguelMadero在评论中提到了这个想法。设置WS / IJ以运行以下命令

path/to/geddy/bin/cli.js 

#1


3  

There's a Debugging WikiPage with some information about how to debug geddy.

有一个Debugging WikiPage,其中包含有关如何调试geddy的一些信息。

#2


1  

I have been unable to verify this, but I believe the issue is due to the fact that cluster spawns new processes but the debugger is unaware of them. I have not found a way to attach the debugger to the new processes, and im not even sure if they can be started with the debugging port open.

我一直无法验证这一点,但我认为问题是由于集群产生了新进程,但调试器没有意识到它们。我还没有找到一种方法将调试器连接到新进程,我甚至不确定它们是否可以在打开调试端口的情况下启动。

Geddy uses cluster so it inherits this issue.

Geddy使用集群,因此它继承了这个问题。

This thread mentions a possible solution: ( How do I enable --debug for node.js when running GeddyJS ) but this did not help me.

这个主题提到了一个可能的解决方案:(如何在运行GeddyJS时为node.js启用--debug),但这对我没有帮助。

#3


1  

Geddy doesn't currently support debugging, but we'd love to add that as a feature.

Geddy目前不支持调试,但我们希望将其添加为功能。

#4


1  

To answer the question specifically for Jetbrains WebStorm or IntelliJ (with the Node.js plugin) debugging:

要专门回答Jetbrains WebStorm或IntelliJ(带有Node.js插件)调试的问题:

In short, set up your app as if you were going to deploy on Heroku or Nodejitsu.

简而言之,设置您的应用程序就像您要在Heroku或Nodejitsu上部署一样。

package.json

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

Next you have two options

接下来你有两个选择

Option 1. Create an app.js that runs geddy.

选项1.创建运行geddy的app.js.

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 app be sure to add an the environment variable GEDDY_ENVIRONMENT and set it to 'development' or 'test' if you want to run your tests.

在WebStorm / IntelliJ中,在Node.js应用程序的运行/调试配置中,如果要运行测试,请务必添加环境变量GEDDY_ENVIRONMENT并将其设置为“development”或“test”。

Option 2 Invoke the geddy client directly

选项2直接调用geddy客户端

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

@MiguelMadero在评论中提到了这个想法。设置WS / IJ以运行以下命令

path/to/geddy/bin/cli.js