Rails - 在任何来源

时间:2018-02-21 13:06:08

标签: mysql ruby bundler globalize rails-generate

我正在使用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]

1 个答案:

答案 0 :(得分:2)

您可以更新问题以显示Gemfile的内容吗?

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

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

  • 我已经看到这种情况因为春天而发生了很多。如果您的Gemfile碰巧有弹簧宝石,请运行bin/spring stop