我正在使用ruby版2.3.3p222
这是我的Gemfile:
# Gemfile
source 'https://rubygems.org'
gem 'pry'
我运行bundle
,这是由此产生的Gemfile.lock
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
coderay (1.1.2)
method_source (0.9.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
PLATFORMS
ruby
DEPENDENCIES
pry
BUNDLED WITH
1.15.1
然后我只需通过ruby my_report.rb
运行ruby脚本(此脚本与Gemfile
和Gemfile.lock
位于同一目录中)。 my_report.rb
只在文件中有这个:
require 'pry'
这是错误:
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/<user>/.rvm/gems/ruby-2.3.3/gems/pry-rescue-1.4.5/lib/pry-rescue.rb:15: warning: method BaseHelpers#windows? is deprecated. Use Pry:Helpers::Platform.windows? instead
/Users/<user>/.rvm/gems/ruby-2.3.3/gems/pry-stack_explorer-0.4.9.2/lib/pry-stack_explorer.rb:128:in `<top (required)>': undefined method `before_command' for #<Pry::CommandSet:0x007fccdcf0b1e8> (NoMethodError)
问题:我错过了什么?如何在pry
中正确地要求我的ruby脚本以便我可以设置断点?
最终对我有用的是我刚卸载了所有通过pry
安装的gem uninstall
版本。然后:在我的gemfile中,我指定了以前版本的0.11.3
:
# Gemfile
source 'https://rubygems.org'
gem 'pry', '0.11.3'
我做了bundle install
,然后运行我的红宝石脚本,这对我有用。