RubyMine 中的 Ruby 调试器

发布于 2024-11-05 11:59:47 字数 1188 浏览 7 评论 0原文

我尝试在 Rubymine 中运行调试器,但不断收到此错误。

/Users/skline/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/bin/rdebug-ide --port 49877 -- /Users/skline/Sites/2t2/app/mailers/user_notifications.rb
Fast Debugger (ruby-debug-ide 0.4.17.beta3, ruby-debug-base 0.11.26) listens on 127.0.0.1:49877
    <internal:lib/rubygems/custom_require>:29:in `require'
    <internal:lib/rubygems/custom_require>:29:in `require'
    /Users/skline/Sites/2t2/app/mailers/user_notifications.rb:1:in `<top (required)>'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/lib/ruby-debug-ide.rb:112:in `debug_load'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/lib/ruby-debug-ide.rb:112:in `debug_program'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/bin/rdebug-ide:87:in `<top (required)>'
    -e:1:in `load'
    -e:1:in `<main>'
Uncaught exception: no such file to load -- safe_mailer

Process finished with exit code 0

有什么想法吗?

I am trying to run the debugger in Rubymine and I keep getting this error.

/Users/skline/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/bin/rdebug-ide --port 49877 -- /Users/skline/Sites/2t2/app/mailers/user_notifications.rb
Fast Debugger (ruby-debug-ide 0.4.17.beta3, ruby-debug-base 0.11.26) listens on 127.0.0.1:49877
    <internal:lib/rubygems/custom_require>:29:in `require'
    <internal:lib/rubygems/custom_require>:29:in `require'
    /Users/skline/Sites/2t2/app/mailers/user_notifications.rb:1:in `<top (required)>'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/lib/ruby-debug-ide.rb:112:in `debug_load'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/lib/ruby-debug-ide.rb:112:in `debug_program'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/bin/rdebug-ide:87:in `<top (required)>'
    -e:1:in `load'
    -e:1:in `<main>'
Uncaught exception: no such file to load -- safe_mailer

Process finished with exit code 0

Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抚你发端 2024-11-12 11:59:47

它看起来像是您的应用程序中的 gem 或其他依赖项发生了更改。您报告的错误似乎嵌入了答案:检查您的 /app/mailers/user_notifications.rb 并查看第 1 行所要求的要求。然后查看第 29 行的 lib/rubygems/custom_require。这两个文件之一似乎要求提供一些它无法找到的内容。我对您正在使用的 gem 没有经验,但似乎您可能错过了 gem 依赖项,有 Gem 版本错误,或者包含不再存在或已移动/更改名称的内容的语句。

It looks like a gem or other dependency changed in your app. The error you're reporting seems to have the answer embedded in it: check your /app/mailers/user_notifications.rb and see what requirement line 1 is calling for. Then look at lib/rubygems/custom_require at line 29. One of those two files appears to be asking for something that it can't find. I've no experience with the gem you are using, but it seems you may have missed a gem dependency, have a Gem version error, or an Include statement for something that no longer exists or has moved/changed names.

三人与歌 2024-11-12 11:59:47

问题

我在使用 Run > 时遇到了类似的错误使用 RubyMine 2016.2.4 进行调试。

/Users/Mp/.rvm/rubies/ruby-2.3.0/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/Mp/.rvm/gems/ruby-2.3.0@global/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 54743 --host 0.0.0.0 --dispatcher-port 54744 -- /Users/Mp/code/apps/ruby_test/team_system/team.rb
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.1, file filtering is supported) listens on 0.0.0.0:54743

Process finished with exit code 0

最初,当我在示例 ruby​​ 文件 team.rb 中设置断点并运行 Run > 时,调试它有效(控制台显示 0> 而不是 Process finish with exit code 0


班级团队
attr_reader:大小
def 初始化(大小)
@尺寸=尺寸
结尾
结尾
团队 = 团队.new(100)

我花了几个小时试图解决这个问题,但没有成功,遵循互联网上的帖子。我准备重新安装 RubyMine,并决定联系他们的支持电子邮件。我告诉我已经尝试了一切,例如:

  • 重新启动计算机
  • 重新启动 RubyMine 并运行 rm -rf .idea
  • 运行 gem pristine --all
  • 尝试使用 ruby​​ 2.1.2 而不是2.3.0(即 rvm install 2.1.2 rvm list rvm use 2.1.2
  • 检查我的 RVM 版本 rvm -v< /code> rvm 1.26.11
  • 使用 gem envwhich ruby​​ 检查 gem 的位置。这表明它们与 /usr/bin/ruby 和 /Users/Ls/.rvm/rubies/ruby-2.3.0/bin/ruby
  • 卸载(即 gem uninstall ...)相关全局 Ruby 位置和默认 RVM 中的 gem
  • 再次重新安装它们
    <代码>
    $ gem 安装 debug_inspector
    $ gem 安装调试器-linecache
    $ gem 安装 ruby​​-debug-ide
    $ gem install debase
    $ gem install debase-ruby_core_source
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debug_inspector
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debug-linecache
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global ruby​​-debug-ide
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debase
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debase-ruby_core_source
    $ gem 安装 linecache19-0.5.13.gem
  • 运行 bundle update
  • 更新到 RubyMine 2016.2.4
  • 转到“文件”>默认设置>语言与框架> Ruby SDK 和 Gems >并选择使用RVM:ruby-2.3.0
  • Going to Run >编辑当前 ruby​​ 文件的配置,然后在“配置”选项卡中单击“使用其他 SDK”并选择 RVM:ruby-2.3.0 [全局](我也尝试过仅选择 RVM:ruby-2.3.0)

解决方案

我从 RubyMine 得到了反馈支持人员建议我向他们展示 gem list 的输出并打开详细输出(设置 > 构建、执行、部署 > 调试器 > 详细调试器)。

他们的反馈没有立即回复,而是给了我一个强有力的线索,这一定是由宝石冲突引起的,所以我尝试了以下方法,让它再次工作!

  • 清除 RubyMine 缓存
    文件>使缓存和缓存无效重新启动>使缓存和缓存无效重新启动
  • 显示全局存储的 Ruby gem,在 RVM 2.3.0(全局)和 RVM 2.3.0(默认)中。注意:我已经过滤了下面显示的列表,仅显示相关的


$ GEM_PATH=$GEM_HOME 宝石列表
本地宝石
降低 (0.2.1)
debase-ruby_core_source (0.9.2)
调试检查器 (0.0.2)
调试器行缓存 (1.2.0)
行缓存19 (0.5.13)
红宝石调试IDE(0.6.1.beta2,0.6.0)
ruby_core_source (0.1.5)

<代码>
$ rvm ruby​​-2.3.0 做 gem 列表
本地宝石
降低 (0.2.1)
debase-ruby_core_source (0.9.2)
调试检查器 (0.0.2)
调试器行缓存 (1.2.0)
行缓存19 (0.5.13)
红宝石调试IDE(0.6.1.beta2,0.6.0)
ruby_core_source (0.1.5)

<代码>
$ rvm ruby​​-2.3.0 @global 做 gem 列表
本地宝石
降低 (0.2.1)
debase-ruby_core_source (0.9.2)
调试检查器 (0.0.2)
行缓存19 (0.5.13)
红宝石调试IDE (0.6.0)

  • 安装最新版本的 Ruby
    <代码>
    $ rvm 安装 ruby​​-2.3.1
  • 显示了 RVM 2.3.1(全局)和 RVM 2.3.1(默认)中的 Ruby gem。两者都有相同的结果


$ rvm ruby​​-2.3.1 做 gem 列表
$ rvm ruby​​-2.3.1 @global 做 gem 列表
本地宝石
大十进制 (1.2.8)
did_you_mean (1.0.0)
宝石包装 (1.2.7)
io-控制台 (0.4.5)
json (1.8.3)
迷你测试 (5.8.3)
网络远程登录 (0.1.1)
power_assert (0.2.6)
心理 (2.0.17)
耙子 (10.4.2)
rdoc (4.2.1)
RVM (1.11.3.9)
测试单元 (3.1.5)

  • 检查了RVM当前版本并从1.26.11升级到最新版本1.27.0
    <代码>
    $ rvm -v
    $ rvm 变得稳定
    $ rvm重新加载
    $ rvm列表
  • 创建了一个专门用于容纳 gem 的 Gemset,以使用 RubyMine 测试功能 https://rvm.io/gemsets/basics
    rvm ruby​​-2.3.1 do rvm gemset create ruby​​mine_2016_4_2
  • 检查 Ruby 版本已更改
    <代码>
    $ 红宝石 -v
    ruby 2.3.1p112(2016-04-26 修订版 54768)[x86_64-darwin15]
  • 打开 RubyMine 2016_2_4 并转到“文件”>“默认设置>语言与框架> Ruby SDK 和 Gems。我取消选择 RVM:ruby-2.3.0,然后选择 RVM:ruby-2.3.1 ruby​​mine_2016_2_4。然后,我单击“绿色勾号”图标将其用于项目,最后单击“确定”,
  • 打开我想要调试的 team.rb 文件,然后打开“运行”>“运行”。编辑配置。然后我选择了其他SDK:RVM:ruby-2.3.1 [rubymine_2016_2_4],最后单击确定。这导致出现一个弹出窗口,指出:“当前未安装调试器所需的 gem debase。您想安装它吗?”。我单击“是
  • 检查”以查看 RubyMine 如何更改我的自定义 ruby​​mine_2016_2_4 gemset


$ rvm ruby​​-2.3.1@rubymine_2016_2_4 做 gem 列表
本地宝石
大十进制 (1.2.8)
降低(0.2.2.beta8,0.2.1)
debase-ruby_core_source (0.9.2)
did_you_mean (1.0.0)
宝石包装 (1.2.7)
io-控制台 (0.4.5)
json (1.8.3)
迷你测试 (5.8.3)
网络远程登录 (0.1.1)
power_assert (0.2.6)
心理 (2.0.17)
耙子 (10.4.2)
rdoc (4.2.1)
ruby-debug-ide (0.6.1.beta2)
RVM (1.11.3.9)
测试单元 (3.1.5)

  • 通过在示例 ruby​​ 文件 team.rb 中设置断点并运行 Run > 再次尝试调试。调试。它工作了,控制台显示 0> 而不是 Process finish with exit code 0

Problem

I got a similar error when using Run > Debug using RubyMine 2016.2.4.

/Users/Mp/.rvm/rubies/ruby-2.3.0/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/Mp/.rvm/gems/ruby-2.3.0@global/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 54743 --host 0.0.0.0 --dispatcher-port 54744 -- /Users/Mp/code/apps/ruby_test/team_system/team.rb
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.1, file filtering is supported) listens on 0.0.0.0:54743

Process finished with exit code 0

Initially when I set a breakpoint in a sample ruby file team.rb and ran Run > Debug it worked (console it displayed 0> instead of Process finished with exit code 0)


class Team
attr_reader :size
def initialize(size)
@size = size
end
end
team = Team.new(100)

I spent hours trying to resolve it without success, following posts on the internet. I was ready to reinstall RubyMine, and I decided to contact their support email. I told I had tried everything, such as:

  • Restarting my computer
  • Restarting RubyMine and running rm -rf .idea
  • Running gem pristine --all
  • Trying with ruby 2.1.2 instead of 2.3.0 (i.e. rvm install 2.1.2 rvm list rvm use 2.1.2)
  • Checking my RVM version rvm -v rvm 1.26.11
  • Checking the location of gems with gem env and which ruby. This indicated they are in both in /usr/bin/ruby and /Users/Ls/.rvm/rubies/ruby-2.3.0/bin/ruby
  • Uninstalling (i.e. gem uninstall ...) relevant gems in both the global Ruby location and default RVM
  • Reinstalling them again

    $ gem install debug_inspector
    $ gem install debugger-linecache
    $ gem install ruby-debug-ide
    $ gem install debase
    $ gem install debase-ruby_core_source
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debug_inspector
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debug-linecache
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global ruby-debug-ide
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debase
    $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debase-ruby_core_source
    $ gem install linecache19-0.5.13.gem
  • Running bundle update
  • Updating to RubyMine 2016.2.4
  • Going to File > Default Settings > Languages & Frameworks > Ruby SDK and Gems > and selecting to use RVM: ruby-2.3.0
  • Going to Run > Edit Configurations for current ruby file, and in Configuration tab clicking "Use Other SDK" and choosing RVM: ruby-2.3.0 [global] (I have also tried choosing just RVM: ruby-2.3.0)

Solution

I got feedback from RubyMine Support suggesting that I show them the output of gem list and to turn on Verbose Output (Settings > Build, Execution, Deployment > Debugger > Verbose debugger).

Instead of responding immediately their feedback gave me a strong clue it must be caused by a gem conflict, so I tried the following approach, which got it to work again!

  • Cleared RubyMine Cache
    File > Invalidate Caches & Restart > Invalidate Caches & Restart
  • Showed Ruby gems stored globally, in RVM 2.3.0 (global), and in RVM 2.3.0 (default). Note: I have filtered the list shown below to only display the relevant ones


$ GEM_PATH=$GEM_HOME gem list
LOCAL GEMS
debase (0.2.1)
debase-ruby_core_source (0.9.2)
debug_inspector (0.0.2)
debugger-linecache (1.2.0)
linecache19 (0.5.13)
ruby-debug-ide (0.6.1.beta2, 0.6.0)
ruby_core_source (0.1.5)


$ rvm ruby-2.3.0 do gem list
LOCAL GEMS
debase (0.2.1)
debase-ruby_core_source (0.9.2)
debug_inspector (0.0.2)
debugger-linecache (1.2.0)
linecache19 (0.5.13)
ruby-debug-ide (0.6.1.beta2, 0.6.0)
ruby_core_source (0.1.5)


$ rvm ruby-2.3.0 @global do gem list
LOCAL GEMS
debase (0.2.1)
debase-ruby_core_source (0.9.2)
debug_inspector (0.0.2)
linecache19 (0.5.13)
ruby-debug-ide (0.6.0)

  • Installed latest version of Ruby

    $ rvm install ruby-2.3.1
  • Showed Ruby gems in RVM 2.3.1 (global) and RVM 2.3.1 (default). Both with same result


$ rvm ruby-2.3.1 do gem list
$ rvm ruby-2.3.1 @global do gem list
LOCAL GEMS
bigdecimal (1.2.8)
did_you_mean (1.0.0)
gem-wrappers (1.2.7)
io-console (0.4.5)
json (1.8.3)
minitest (5.8.3)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (2.0.17)
rake (10.4.2)
rdoc (4.2.1)
rvm (1.11.3.9)
test-unit (3.1.5)

  • Checked current version of RVM and upgraded from 1.26.11 to latest version 1.27.0

    $ rvm -v
    $ rvm get stable
    $ rvm reload
    $ rvm list
  • Created a Gemset specifically for housing gems to test functionality using RubyMine https://rvm.io/gemsets/basics
    rvm ruby-2.3.1 do rvm gemset create rubymine_2016_4_2
  • Checked Ruby version had changed

    $ ruby -v
    ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
  • Opened RubyMine 2016_2_4 and went to File > Default Settings > Languages & Frameworks > Ruby SDK and Gems. I unselected RVM: ruby-2.3.0, and then instead selected RVM: ruby-2.3.1 rubymine_2016_2_4. I then clicked the 'green tick' icon to use it for the project, and finally clicked OK
  • With the team.rb file that I wanted to debug opened, I then opened Run > Edit Configurations. I then selected Other SDK: RVM: ruby-2.3.1 [rubymine_2016_2_4], and finally clicked OK. This caused a popup window to appear stating: "the gem debase required by the debugger is not currently installed. Would you like to install it?". I clicked Yes
  • Checked to see how RubyMine had changed my custom rubymine_2016_2_4 gemset


$ rvm ruby-2.3.1@rubymine_2016_2_4 do gem list
LOCAL GEMS
bigdecimal (1.2.8)
debase (0.2.2.beta8, 0.2.1)
debase-ruby_core_source (0.9.2)
did_you_mean (1.0.0)
gem-wrappers (1.2.7)
io-console (0.4.5)
json (1.8.3)
minitest (5.8.3)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (2.0.17)
rake (10.4.2)
rdoc (4.2.1)
ruby-debug-ide (0.6.1.beta2)
rvm (1.11.3.9)
test-unit (3.1.5)

  • Tried debugging again by setting a breakpoint in the sample ruby file team.rb and ran Run > Debug. It worked and console it displayed 0> instead of Process finished with exit code 0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文