Why can't Bundler locate this gem?
Why can’t bundler locate the Mechanize gem?
The following is in my Rails project’s Gemfile:
Running bundle install throws the following error:
Updating git://github.com/tenderlove/mechanize.git Fetching source index for http://rubygems.org/ Could not find gem 'mechanize (>= 0)' in git://github.com/tenderlove/mechanize.git (at master). Source does not contain any versions of 'mechanize (>= 0)'
I arrived at this problem after forking the project to make some small changes, but was not able to get bundler to use the github location nor a local path. Why is it that it cannot locate the gem?
If I remove all instructions and simply do
gem 'mechanize' then it works flawlessly.
Versions: Bundler 1.0.14 + Rails 3.1 Release Canditate + Ruby 1.8.7 (via RVM) + Debian 5
5 Solutions collect form web for “Why can't Bundler locate this gem?”
It looks as though the project is missing a gemspec and one won’t be getting added.
You should be able to clone the project into your vendor/gems directory. You will need to create a mechanize.gemspec file, too.
You would then require it in your Gemfile using something like.
gem 'mechanize', :path => 'vendor/gems/mechanize'
I have seen older version of bundler having issues with git:// like urls.
Have you tried updating bundler; or replacing git:// with http:// ?
In case someone stumbles upon this thread in the future, here’s what I did to make it work..
I forked the project, made my changes then ran the following to generate a .gemspec:
rake debug_gem | grep -v "(in " > `basename \`pwd\``.gemspec
I had to make a slight modification because the gemspec was trying to include a .gemtest file which did not exist.
I then modified my Gemfile to source from the path:
gem 'mechanize', :path => '/my_rails_app/vendor/gems/mechanize'
I then ran bundle install and everything went through without a hitch.
Use version explicitly. They don’t support unreleased versions, so they delete gemspec file.
gem 'mechanize', '2.0.1'
It works for me.
I was facing the same issue, i changed by adding gem version in between name and path.
gem ‘image_core’, ‘0.0.1’, :path => ‘./lib/engine/image_core’