Rake Aborted: Could Not Find Rspec

Rake Aborted! Gem::LoadError: Could not find rspec 'x' but did find 'y'

That tutorial has a Gemfile that specifies that it needs rspec ">= 2.0" which probably excludes rspec 3. To install the proper versions of all needed gems, try these commands in the same folder as the Gemfile:

gem install bundler
bundle

EDIT: Actually, I think that tutorial's Gemfile is broken and didn't properly specify what version of rspec they wanted to use. They should have something like "~> 2.0" instead of ">= 2.0" I think. Try uninstalling rspec with gem uninstall rspec and then do gem install rspec -v 2.14.1. You could open a github issue asking them to update the tutorial to account for the new RSpec 3.x, which is not compatible with 2.x.

Bundler cannot find rake but it seems installed

So, I finally managed to get this error to go away. I started thinking it was some weird permission issue.

To solve this problem, I did the following:

  • Open the Disk Utility, Applications/Utilities/Disk Utility
  • Repair Permissions
  • Remove the .bundle directory in my project
  • Remove the vendor directory in my project
  • Remove the Gemfile.lock
  • bundle install

After that it started working without complaining about not finding rake. Crazy, man. Ugh. Hopefully this helps other folks if they run into the same issue.

Bundler could not find rake in any of the resources

I'm not really sure what happened and why but I tried doing this on my rails container and I was no longer receiving the said error.

  1. docker-compose run --rm <container> bash
  2. cd to project directory
  3. bundle install

Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources

bundle config set --local path 'vendor/cache'

generally fixes it as that is the more common problem. Basically, your bundler path configuration is messed up. See their documentation (first paragraph) for where to find those configurations and change them manually if needed.

LoadError: cannot load such file -- rspec/core/rake_task

It seems that running bundle exec rake -t will work. Per bundler.io http://bundler.io/man/bundle-exec.1.html
I suggest adding bundle exec to ensure that we are using the Gem specified in the current context. Also see this SO post. What does bundle exec rake mean?



Related Topics



Leave a reply



Submit