Could not find i18n-0.6.0 in any of the sources

2019-04-26 13:28发布

问题:

I just upgraded from Rails 3.0.3 to 3.2.1. The upgrade went smoothly on my Mac but I'm having trouble getting a 3.2.1 instance of my app running on my Ubuntu production server. The error I'm getting is this:

Could not find i18n-0.6.0 in any of the sources (Bundler::GemNotFound)

Obviously, other people have had this same problem before. Unfortunately, the solution here doesn't fix it for me. Doing sudo bundle install doesn't seem to make a difference.

I also found this post but I don't understand what exactly the OP did that fixed the problem.

There's this post as well but the OP's problem there just kind of went away by itself.

And I do have the i18n gem installed:

$ gem list | grep i18n
i18n (0.6.0, 0.5.0)

I have no idea what could be wrong. Any ideas?

回答1:

I had exactly the same error. Are you using rvm and passenger?

If you had rvm installed before starting passenger installation, after passenger finishes its installation it gives you the instructions for updating apache configuration with something similar to:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p125@global/ruby

I've installed passenger with global gemset but later I created another gemset which I used for my app (let's call this new gemset 'foo').

The solution that worked for me was to change 'global' to 'foo' in the 3rd line:

PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p125@foo/ruby


回答2:

bundle install --deployment worked for me.



回答3:

An .rvmrc file at the root of your app solves this problem. Via rvm documentation:

# my-app-name/.rvmrc
if [[ -s "/Users/sutto/.rvm/environments/ree-1.8.7-2010.02@my-app-name" ]] ; then
  . "/Users/sutto/.rvm/environments/ree-1.8.7-2010.02@my-app-name"
else
  rvm --create use  "ree-1.8.7-2010.02@my-app-name"
fi

Replace with the correct user, Ruby version and gemset where applicable. (Linux users will probably have home/username/.rvm...)

Now let's add the setup_load_paths.rb so passenger has the correct paths (shouldn't have anything to change here):

# my-app-name/config/setup_load_paths.rb
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
  begin
    require 'rvm'
    RVM.use_from_path! File.dirname(File.dirname(__FILE__))
  rescue LoadError
    raise "RVM gem is currently unavailable."
  end
end

# If you're not using Bundler at all, remove lines bellow
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'


回答4:

I was having the same problem and I realised I was using jRuby to rake (I was using RVM). With Ruby it went without a problem :)

Therefore, make sure you're using Ruby instead of jRuby. Just in case you're using RVM as well, use:

rvm list

To get the list of all rubies installed and

rvm use ruby-...

To select it.