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
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.
docker-compose run --rm <container> bash
cd to project directory
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
Include Module in All Minitest Tests Like in Rspec
Does The Rails Orm Limit The Ability to Perform Aggregations
Setting Up Configuration Settings When Writing a Gem
In Ruby, How to Be Warned of Duplicate Keys in Hashes When Loading a Yaml Document
Is The Assignment Operator Really "Just" an Operator
How Does String.Unpack Work in Ruby
Error Installing Ruby in Yosemite
Rvm Can No Longer Install 1.8.7-P352 on MAC Os X Mountain Lion
How Can Multiple Trailing Slashes Can Be Removed from a Url in Ruby
Many to Many Table with an Extra Column in Rails
Error Installing Rdoc Documentation: Incompatible Encoding Regexp Match
Without Converting to a String, How Many Digits Does a Fixnum Have
Use Pry in Gems Without Modifying The Gemfile or Using 'Require'
Error Generating Source Map - Grunt and SASS Configuration
Using Cucumber with Modular Sinatra Apps
"Previous Post" and "Next Post" Link in Show View (Nested Resources)