首页 > 解决方案 > 使用 RubyMine 调试 Rails 5:断点不起作用

问题描述

我刚刚安装了最新的 RubyMine (2018.1.1),并使用 RubyMine 中的向导创建了一个 Rails 5.2 应用程序。然后我生成了一个脚手架,以便我可以进行一些测试。

如果我在单元测试中设置断点,则断点有效。但是,如果我运行 Web 服务器(我都尝试了 - 默认 Puma 和 WEBrick),则没有断点工作。我可以从我的控制器中看到打印语句,但从未触发断点。

我究竟做错了什么?

这是我的宝石清单:

actioncable (5.2.0)
actionmailer (5.2.0)
actionpack (5.2.0)
actionview (5.2.0)
activejob (5.2.0)
activemodel (5.2.0)
activerecord (5.2.0)
activestorage (5.2.0)
activesupport (5.2.0)
addressable (2.5.2)
archive-zip (0.11.0)
arel (9.0.0)
bigdecimal (default: 1.3.4)
bindex (0.5.0)
bootsnap (1.3.0)
builder (3.2.3)
bundler (1.16.1)
byebug (10.0.2)
capybara (3.0.3)
childprocess (0.9.0)
chromedriver-helper (1.2.0)
cmath (default: 1.0.0)
coffee-rails (4.2.2)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.4)
csv (default: 1.0.0)
date (default: 1.0.0)
debase (0.2.2)
debase-ruby_core_source (0.10.3)
erubi (1.7.1)
etc (default: 1.0.0)
execjs (2.7.0)
fcntl (default: 1.0.0)
ffi (1.9.23)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
globalid (0.4.1)
i18n (1.0.1)
io-console (default: 0.4.6)
io-like (0.3.0)
ipaddr (default: 1.2.0)
jbuilder (2.7.0)
json (default: 2.1.0)
listen (3.1.5)
loofah (2.2.2)
mail (2.7.0)
marcel (0.3.2)
method_source (0.9.0)
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
msgpack (1.2.4)
multi_json (1.13.1)
nio4r (2.3.0)
nokogiri (1.8.2)
openssl (default: 2.1.0)
psych (default: 3.0.2)
public_suffix (3.0.2)
puma (3.11.4)
rack (2.0.5)
rack-test (1.0.0)
rails (5.2.0)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.4)
railties (5.2.0)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
rdoc (default: 6.0.1)
ruby-debug-ide (0.7.0.beta4)
ruby_dep (1.5.0)
rubyzip (1.2.1)
sass (3.5.6)
sass-listen (4.0.0)
sass-rails (5.0.7)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
selenium-webdriver (3.11.0)
spring (2.0.2)
spring-watcher-listen (2.0.1)
sprockets (3.7.1)
sprockets-rails (3.2.1)
sqlite3 (1.3.13)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.1.1)
turbolinks-source (5.1.0)
tzinfo (1.2.5)
uglifier (4.1.10)
web-console (3.6.2)
webrick (default: 1.4.2)
websocket-driver (0.7.0)
websocket-extensions (0.1.3)
xpath (3.0.0)
zlib (default: 1.0.0)

我在用ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]

标签: ruby-on-railsdebuggingrubymine

解决方案


这个问题记录在这里:https ://youtrack.jetbrains.com/issue/RUBY-20684

还指定了一种解决方法: comment bootsnap requiring in the Gemfile and in the boot.rb

注释掉bootsnap对我有用——断点现在可以工作了。


推荐阅读