Domanda

I want to run a Ruby on rails server, but a certain gem doesn't want to install. This rails program is not compatible with ruby 2.0, so I want to use ruby 1.9.3, which I installed, but I can't bundle install anymore...

$ bundle install
# ...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ bundle exec rails s
git://github.com/goodtouch/jbuilder.git (at master) is not yet checked out. Run `bundle install` first.
$ bundle show jbuilder
/Users/julien/.bundler/ruby/2.0.0/jbuilder-7fb0eae924c7
$ ruby --version
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-darwin13.1.0]

In the Gemfile, I specified ruby "1.9.3", then I ran bundle install again and got:

Your Ruby version is 2.0.0, but your Gemfile specified 1.9.3

The Gemfile line for this specific gem:

gem 'jbuilder', git: "git://github.com/goodtouch/jbuilder.git"

And what I get in the Gemfile.lock:

GIT
  remote: git://github.com/goodtouch/jbuilder.git
  revision: 7fb0eae924c77318ede344f32a5c208b91cdbaac
  specs:
    jbuilder (0.4.1)
      activesupport (>= 3.0.0)
      blankslate (>= 2.1.2.4)

I really don't understand what's going on. I'm under Mac OS X.

Thank you.

È stato utile?

Soluzione

Edit: You have to use rvm or rbenv to set ruby version. This is not set in the gem file. Ruby is not a gem.

This error might have one of many reasons.

From the Bundler issues

# remove user-specific gems and git repos
rm -rf ~/.bundle/ ~/.gem/bundler/ ~/.gems/cache/bundler/

# remove system-wide git repos and git checkouts
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/

# remove project-specific settings
rm -rf .bundle/

# remove project-specific cached gems and repos
rm -rf vendor/cache/

# remove the saved resolve of the Gemfile
rm -rf Gemfile.lock

# uninstall the rubygems-bundler and open_gem gems
rvm gemset use global # if using rvm
gem uninstall rubygems-bundler open_gem

# try to install one more time
bundle install

Altri suggerimenti

My issue was because my gemfile.lock was using the different

BUNDLED WITH

check the version and see if they match

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top