LoginSignup
0
1

More than 3 years have passed since last update.

【Rails】RailsにReactをインストールしようとしてエラーが出たときの対処法【React】Gemfile`: You cannot specify the same gem twice with different version requirements.

Posted at

症状

この記事を参考に、RailsにReactをインストールするために、bundle installしたらエラーが出てしまいました。

Rails v6.0.3

Gemfile
gem 'react-rails'
gem 'webpacker'
ターミナル
bundle install

[!] There was an error parsing `Gemfile`: You cannot specify the same gem twice with different version requirements.
You specified: webpacker (>= 0) and webpacker (= 4.0.7). Bundler cannot continue.

 #  from /home/ubuntu/environment/neighbor_food/Gemfile:18
 #  -------------------------------------------
 #  gem 'sass-rails',                 '5.1.0'
 >  gem 'webpacker',                  '4.0.7'
 #  gem 'turbolinks',                 '5.2.0'

解決方法

Gemファイルの記載をエラーの文言通りにバージョンを追加したら、installが通りました。

Gemfile
gem 'sass-rails',                 '5.1.0'
gem 'webpacker',                  '4.0.7'
ターミナル
bundle install

参考

ReactをRailsと共に使う方法
https://qiita.com/k-penguin-sato/items/e3cc04f787cf3254cfae

0
1
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
1