11
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ruby on Rails チュートリアル 3章のguardがエラーで失敗する

Last updated at Posted at 2020-03-27

※ 修正完了しているようです。

症状

Cloud9を利用して Ruby on Railsチュートリアル 3.6.2 Guardによるテストの自動化 を進めていましたが、bundle exec guardを実行したところ以下のようなエラーで失敗します。

/home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/jobs/pry_wrapper.rb:131:in `_setup': undefined method `file=' for #<Pry::History:0x00000000028ee2f0>
Did you mean?  filter (NoMethodError)
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/jobs/pry_wrapper.rb:68:in `initialize'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/interactor.rb:15:in `new'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/interactor.rb:15:in `initialize'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard.rb:67:in `new'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard.rb:67:in `setup'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/commander.rb:32:in `start'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/cli/environments/valid.rb:16:in `start_guard'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/cli.rb:122:in `start'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:32:in `execute'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!'
        from /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/guard-2.13.0/bin/_guard-core:11:in `<main>'

ふむふむ・・・ライブラリ自体からエラーが出てるので、バージョン差異な匂いがプンプンするぜ?

解決方法

Gemfileのguardのバージョンを最新 (2.16.2) にして bundle update bundle install --without production としたところ無事動きました。

Gemfile
group :test do
  gem 'rails-controller-testing', '1.0.2'
  gem 'minitest',                 '5.10.3'
  gem 'minitest-reporters',       '1.1.14'
  gem 'guard',                    '2.16.2'  # これ
  gem 'guard-minitest',           '2.4.4'
end

Twitterにて公式に報告あげておきました。
初心者には結構厳しいバグですね(´・ω・`)

11
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?