![](/img/trans.png)
[英]Error when running Rails Server on a local copy: Could not find mysql2-0.2.6 in any of the sources. Try running `bundle install`
[英]Rails - Could not find i18n-0.9.5 in any of the sources
我正在使用 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
的內容嗎?
同時,您可以嘗試以下 2 條建議:
如果您使用 gemset 管理您的 gems,您可以使用rvm gemset empty gemsetname
或 rbenv 等效項(如果您使用 rbenv)刪除該特定項目的rvm gemset empty gemsetname
。 然后再次運行捆綁安裝。
因為春天,我經常看到這種情況發生。 如果您的Gemfile
碰巧有 spring gem,請運行bin/spring stop
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.