我无法让我的ruby-debug-ide正常工作。我有一个基本的rails应用程序,我想在RubyMine中调试。在我启动RubyMine之前,我需要在我的流浪虚拟机中启用rdebug-ide。当我导航到我的项目目录时,我已经在线阅读了我需要输入以下命令:
rdebug-ide --port 1236 --dispatcher-port 26166 --host 0.0.0.0 - bin/rails s -b 0.0.0.0
但是,当我运行此命令时,我收到以下消息:
我还尝试了上述命令的一个修改版本:(一个额外的破折号)
rdebug-ide --port 1236 --dispatcher-port 26166 --host 0.0.0.0 -- bin/rails s -b 0.0.0.0
我得到的结果是:
这一开始看起来不错,但之后服务器就再也不会启动了。它从来没有显示服务器信息,它只是坐在这里,挂起,直到我CTRL+C出服务器。我不能让rdebug-ide与rails一起工作。有人知道我怎么解决这个问题吗?
发布于 2017-10-25 06:12:09
我已经可以进行RubyMine远程调试了:-)
在开始之前,请确保已经安装了debase和rdebug-ide:
gem list | grep debase
gem list | grep ruby-debug-ide
sudo gem install debase
sudo gem install ruby-debug-ide
1.启动Rails服务器
首先,您需要启动Rails服务器:
hello_rails$ rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails server
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.2.beta10, file filtering is supported) listens on 0.0.0.0:1234
作为参考,我的Ruby、Rails和Ubuntu版本如下:
$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux-gnu]
$ rails -v
Rails 5.1.4
$ lsb_release -a
Description: Ubuntu 16.04.3 LTS
Codename: xenial
正如您所注意到的,服务器似乎从未启动过。它就挂在那里。这实际上是正确的。它挂在那里,等待连接,例如来自RubyMine的。
2.从RubyMine远程调试
现在启动RubyMine (我正在使用RubyMine 2017.2.4),运行-> Debug...->编辑配置...
单击加号'+‘添加新配置,然后选择Ruby remote debug。
填写表单并单击Debug按钮。立即服务器不再挂在那里,Rails服务器启动:
hello_rails$ rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails server
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.2.beta10, file filtering is supported) listens on 0.0.0.0:1234
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0.8.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
=> Booting Puma
=> Rails 5.1.4 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.10.0 (ruby 2.4.2-p198), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
最后,您可以在RubyMine中设置断点,并开始远程调试:-)
发布于 2020-07-17 01:25:11
在最新版本的ruby-debug-ide中,您可以在运行时使用--skip_wait_for_start,它会立即启动rails服务器(参见https://github.com/ruby-debug/ruby-debug-ide/pull/167/files)
发布于 2016-06-24 20:57:49
我认为您应该将该命令添加到RubyMine内部的Ruby Remote Debug配置中。
Run > Edit Configurations > Add Ruby remote debug
配置。
https://stackoverflow.com/questions/32638976
复制相似问题