【问题标题】:Rails - Could not find i18n-0.9.5 in any of the sourcesRails - 在任何来源中都找不到 i18n-0.9.5
【发布时间】:2018-08-01 01:57:14
【问题描述】:

我正在使用 MySQL 开发一个 Ruby 网站,并且正在使用 Globalize 进行国际化。

但是,当我运行 rails g migration create_translation_for_articles 终端显示如下:

Could not find i18n-0.9.5 in any of the sources
Run `bundle install` to install missing gems.

我将 gem 'i18n', '~> 0.9.5' 添加到 Gemfile 并运行 bundle install 但仍然没有变化。

我该如何解决这个问题?

更新:当我运行任何rails g 命令时会出现该消息

注意:添加或不添加 gem 没有区别。使用gem install 安装i18n 也会得到相同的结果。

我的 Gemfile 的内容是:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


gem 'rails', '~> 5.1.4'
gem 'mysql2', '>= 0.3.18', '< 0.5'
gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'


gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'

gem 'jbuilder', '~> 2.5'

gem 'devise', '~> 4.4'
gem 'toastr-rails', '~> 1.0', '>= 1.0.3'


gem 'activeadmin', '~> 1.1'

gem 'cancancan', '~> 2.1', '>= 2.1.3'

gem 'omniauth-facebook', '~> 4.0'
gem 'omniauth-google-oauth2', '~> 0.5.2'
gem 'dotenv', '~> 2.2', '>= 2.2.1'

gem 'paperclip', '~> 5.1'
gem 'paperclip-av-transcoder'

gem 'countries', '~> 2.1', '>= 2.1.3'
gem 'flag-icons-rails'

gem 'country_select'

gem 'activeadmin_froala_editor', '~> 0.1.2'
gem 'jquery-rails', '~> 4.3', '>= 4.3.1'

gem 'friendly_id', '~> 5.2', '>= 5.2.3'

gem 'rails-i18n', '~> 5.1'
gem 'geocoder', '~> 1.4', '>= 1.4.5'
gem 'globalize', '~> 5.1'
gem 'activeadmin-globalize', '~> 1.0.0.pre'


group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
   # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

【问题讨论】:

  • Gemfile 顶部的source 是什么?如果您尝试通过gem install i18n -v 0.9.5 本地安装它是否有效?
  • 没有。即使使用geme install i18n -v 0.9.5,它也不起作用

标签: mysql ruby bundler globalize rails-generate


【解决方案1】:

您能否更新您的问题以显示您的Gemfile 的内容?

与此同时,您可以尝试以下 2 条建议:

  • 如果您使用 gemset 管理您的 gem,您可以使用 rvm gemset empty gemsetname 或 rbenv 等效项(如果您使用 rbenv)删除该特定项目的 gemset。然后再次运行 bundle install。

  • 由于春天,我经常看到这种情况发生。如果您的 Gemfile 中恰好有 spring gem,请运行 bin/spring stop

【讨论】:

  • 我用我的 Gemfile 的内容更新了我的问题
  • 好的,看到了,从你的终端运行bin/spring stop,然后再试一次。这有帮助吗?
  • 不,没有帮助我。啊哈,rm Gemfile.lock; 为我修好了!
猜你喜欢
  • 2012-03-18
  • 2013-12-29
  • 1970-01-01
  • 1970-01-01
  • 2015-02-25
  • 2014-03-02
  • 2013-06-22
  • 1970-01-01
  • 2012-06-08
相关资源
最近更新 更多