Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rspec stops working suddenly because of `require': no such file to load

Rspec has been running fine for a while but then I suddenly encounter this issue when running any rspec tests:

/Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:437:in `require': no such file to load -- rspec/instafail (LoadError)
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:437:in `block in requires='
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:435:in `map'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:435:in `requires='
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration_options.rb:20:in `block in configure'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration_options.rb:19:in `each'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration_options.rb:19:in `configure'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:21:in `run'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:66:in `rescue in run'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:62:in `run'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'

I usually have a couple of checkouts of my project (i.e. git clone twice into separate directories). For some reason rspec would encounter this issue only in one of my checkouts and not the other even when using the same version of the code. I eventually circumvented the issue by creating another clone. This issue has popped up again for some reason, and I don't want to have to keep creating clones to avoid the issue. Does anyone know what might be the root cause?

like image 699
JZC Avatar asked Dec 10 '25 07:12

JZC


1 Answers

Turns out the issue was gems like rspec-instafail were grouped as a development gem. At some point in the past I had run 'bundle install --without development' and apparently subsequent bundle installs are done with that option automatically. As a result, those gems weren't on my $LOAD_PATH.

To fix it, I just ran 'bundle install --without asdf' and since there isn't an 'asdf' group it installed all the gems. There's probably a more appropriate option to re-add those groups, but this worked for me.

like image 192
JZC Avatar answered Dec 12 '25 22:12

JZC