Bundler errors in an environment with Rails 3.1 gem installed

I have Rails 3.0.10 and 3.1 installed because I'm trying to use both for two different projects.

In my Rails 3.0.10 project, I have the following at the top of my Gemfile:

gem 'rails', '3.0.10'

However, after starting up, bundle install; bundle exec rails --versionI get the following:

/Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in `setup': You have already activated activesupport 3.1.1, but your Gemfile requires activesupport 3.0.10. Using bundle exec may solve this. (Gem::LoadError)
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:17:in `setup'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:340:in `exec'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in `send'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/bin/bundle:13
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/bin/bundle:19:in `load'
    from /Users/bradley/.rbenv/versions/ree-1.8.7-2011.03/bin/bundle:19

Any ideas? Obviously, I am already using bundle execand bundle show rails; bundle show activesupportto confirm that I have to use the correct versions of gemstones. Should I just uninstall Rails 3.1?

+1
source share
4 answers

I ran into the same problem.

Even when I explicitly specify the version of activesupport to use in my Gemfile:

gem 'rails', '3.2.9'
gem 'activesupport', '3.2.9'

it still gives me this error when I run bundle exec rails s:

/home/tyler/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.0.18/lib/bundler/runtime.rb:31:in `block in setup':
You have already activated activesupport 3.2.10, but your Gemfile requires activesupport 3.2.9. Consider using bundle exec. (Gem::LoadError)

, Rails , Rails.

, gemset ( ) , gemset "" ( / Rails 3.2.10, Rails 3.2.9), - !

, , - , :

gem uninstall activesupport -v 3.2.10

, Bundler, Rails ( -, / , Bundler, Bundler...).

: gem , gem (, /home/tyler/.rvm/gems/ruby-1.9.3-p194/specifications/activesupport-3.2.10.gemspec) raise 'disabled' . Bundler activesupport 3.2.10 ( ) activesupport, (activesupport 3.2.9).

activesupport 3.2.10, raise.

, , - , .

+3

gem rails :

gem 'rails', '3.2.2'

: bundle update

+1

.rvmrc RAILS_ROOT ( )

:

vm_install_on_use_flag=1
rvm_gemset_create_on_use_flag=1
rvm use ruby-1.9.2-p290@APPNAME

APPNAME . CD , . -, "", . Bundle install .

2 gemsets, , . .

0

, Ruby Version Manager (RVM).

ruby, , gemsets, ( ) , .

, :

gem clean -d # dry mode will simply tell you what will get cleaned

gem clean -v # will remove all older versions of every single gem

, ( , )

gem uninstall actionmailer actionpack activerecord activesupport acriveresource rails -v=3.1.0

, . !

0

Source: https://habr.com/ru/post/1785653/


All Articles