Failed to load command: rspec

Hey all,

I’m having a weird problem… My rspec was working just fine before, but all of a sudden, I got this error text:

bundler: failed to load command: rspec (/Users/reedgaines/.rbenv/versions/2.3.1/bin/rspec)

I’ve tried manually reinstalling rspec (per Thai’s instructions in this thread, but no dice, still the same error.

Can anyone help me out with this? If it’s helpful, I’m on a Macbook Air running 10.12.5 Sierra.


Hey! What is the line that you are trying to run, and where are you in your project?

Hey Michael,

I was refactoring some of the stuff from my old rspec projects, actually. This is for rspec 01. The full error dump is this:

bundler: failed to load command: rspec (/Users/reedgaines/.rbenv/versions/2.3.1/bin/rspec)
SyntaxError: /Users/reedgaines/AppAcademy/ce63d6a2-reed.gaines-rspec-1/lib/02_calculator.rb:35: syntax error, unexpected keyword_end, expecting end-of-input
/Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in load' /Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:inblock in load_spec_files’
/Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in each' /Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:inload_spec_files’
/Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in setup' /Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:inrun’
/Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in run' /Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:ininvoke’
/Users/reedgaines/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-3.2.3/exe/rspec:4:in <top (required)>' /Users/reedgaines/.rbenv/versions/2.3.1/bin/rspec:23:inload’
/Users/reedgaines/.rbenv/versions/2.3.1/bin/rspec:23:in `<top (required)>’

On a related note, I’ve never been able to bundle exec rspec a specific file in a project, for example bundle exec rspec 00_silly_blocks.rb. That’s always given me an error message, too.

Hm. I’m sorry if this isn’t what you’re asking for, I’m a bit new at this.


Not sure if I can help with your original Q, but I figured out that I have to type spec/ to change into the directory before I can call individual files:

bundle exec rspec spec/03_iteration_spec.rb

Thanks for that. It doesn’t fix the error I get (I still get bundler: failed to load command: rspec (/Users/reedgaines/.rbenv/versions/2.3.1/bin/rspec), no matter which thing I’m working on, if I reference a specific file), but that will be useful for checking once I get this rspec/bundler issue figured out.

Whoops. I was typing the file I wrote instead of the spec file. Don’t mind me!