Why can't Bundler locate this gem?

Why can’t bundler locate the Mechanize gem?

The following is in my Rails project’s Gemfile:

  • Can't run Jenkins Build - bundle: “command not found”
  • Ruby “bundle install” error on Openshift
  • Should Gemfile.lock be included in .gitignore?
  • Force bundle install to use https:// instead of git:// for GitHub-based gems
  • How to force the update of a gem with bundler?
  • Developing gems and using them in rails projects with bundler, is there a faster way?
  • gem 'mechanize', :git => 'git://github.com/tenderlove/mechanize.git'

    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

  • What's the difference between `git diff --patience` and `git diff --histogram`?
  • configuring user and password with git bash
  • Where does git config --global get written to?
  • Difference between Git and libgit2
  • pull instead of fetch - accidentally merged remote master into local branch
  • Git workflow: How to merge commits made only on new branch
  • 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’

    Git Baby is a git and github fan, let's start git clone.