0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

gem 'rails-i18n', '~> 6.0.0'を追加し、bundle install でエラーが出た時の解決方法

Posted at

エラーの出現

Rails5でエラーメッセージの日本語化をするために
Gemfileに下記を追加

gem 'rails-i18n', '~> 6.0.0'

次に、ターミナルにて

$ bundle install

を実行したところ、下記のエラーが発生しインストールができない。


The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
  In snapshot (Gemfile.lock):
    railties (= 5.2.4.3)

  In Gemfile:
    coffee-rails (~> 4.2) was resolved to 4.2.2, which depends on
      railties (>= 4.0.0)

    rails (~> 5.2.4, >= 5.2.4.3) was resolved to 5.2.4.3, which depends on
      railties (= 5.2.4.3)

    rails-i18n (~> 6.0.0) was resolved to 6.0.0, which depends on
      railties (>= 6.0.0, < 7)

    sass-rails (~> 5.0) was resolved to 5.1.0, which depends on
      railties (>= 5.2.0)

    web-console (>= 3.3.0) was resolved to 3.7.0, which depends on
      railties (>= 5.0)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

#エラー原因

gem 'rails-i18n', '~> 6.0.0'

のバージョン指定が間違っていた。
上記バージョンはrails6の場合だった。

#解決方法
今回のrailsのバージョンはrails5だったので、その場合は、

gem 'rails-i18n', '~> 5.1'

とすればOK!!

その後、

$ bundle install

を実行したら無事インストールできた。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?