LoginSignup
7
4

More than 5 years have passed since last update.

Ruby2.4.0 & Rails5.0.1にアップデートしたらエラーが発生したgemたち

Last updated at Posted at 2017-02-24

何かしらのエラーが出るとは予想していましたが....
案の定出現しました( ・ὢ・ )

開発環境

  • Vagrant 1.9.1(CentOS7.1)
  • Ruby 2.4.0
  • Rails 5.0.1

Rubyのバージョンは、rbenvで管理しています。

アップデート後エラーが発生したgem

・bundle

unicornを再起動しようとすると
「bundleがあるのはruby2.3.0 だよ〜」と怒られる。

[vagrant@localhost rails_5]$ bundle exec unicorn_rails -c config/unicorn.rb
rbenv: bundle: command not found
The `bundle' command exists in these Ruby versions:
2.3.0

どうやら、bundleはRubyのバージョンごとに管理されているので
bundle installを行う必要があるそうです。

bundle install --path vendor/bundle

【参考】
rbenvでRubyの最新のバージョンに対応する

・rubocop & rainbow

bundle installを実行するとエラー発生

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

can't modify frozen String

Gem files will remain installed in /vagrant/hello_gyouza/rails_5/vendor/bundle/ruby/2.4.0/gems/rainbow-2.2.1 for inspection.
Results logged to /vagrant/hello_gyouza/rails_5/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/rainbow-2.2.1/gem_make.out

An error occurred while installing rainbow (2.2.1), and Bundler cannot continue.
Make sure that gem install rainbow -v '2.2.1' succeeds before bundling.

rainbowというgemで引っかかったようです。
入れた覚えがないgemなのにな〜と調べてみたら
rubocopと依存関係にあるgemでした。

RubyGemsをupdateするとエラー解消できました。

gem update --system

【参考】
Bundler 0.14 breaks 2.2.1 build #48

・draper

bundle installもできたしunicornを立ち上げるぞ〜〜!
と思ったらエラー発生

LoadError: cannot load such file -- active_model/serializers/xml

active_model/serializers/xml が読み込めないとのこと。
Gemfileにgemを追加してインストールするとエラーが解消されました。

▼Gemfileにactivemodel-serializers-xmlを追加

gem 'activemodel-serializers-xml'
bundle install --path vendor/bundle

【参考】
Draper relies on active_model/serializers/xml which is being removed in Rails 5 #697

・where-or

またもやエラー発生....
早く..unicorn起動させて..........

Congrats for being on Rails 5. Now please remove this patch by getting rid of the where-or gem

Rails5でOR句は使えるようになったから、gemは消そっ♪とのこと。
'where-or'を抹消すると無事エラー解消!

gem uninstall where-or

unicornも起動できました!
\\\ ٩( 'ω' )و ////

7
4
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
7
4