2019-08-25
2019-08-26
unicornでエラー `block in builder': wrong number of arguments (

本サービスのアプリケーションサーバーはunicornを利用しているのですが、最近gemをアップデートしたところ以下のようにエラーが発生しました
unicornのエラー文
.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/unicorn-5.5.0/lib/unicorn.rb:49:in `block in builder': wrong number of arguments (given 0, expected 2) (ArgumentError) from .rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/unicorn-5.5.0/bin/unicorn_rails:139:in `block in rails_builder' from .rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/unicorn-5.5.0/lib/unicorn/http_server.rb:794:in `build_app!' from .rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/unicorn-5.5.0/lib/unicorn/http_server.rb:141:in `start' from .rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/unicorn-5.5.0/bin/unicorn_rails:209:in `<top (required)>' from.rbenv/versions/2.5.0/bin/unicorn_rails:23:in `load' from /home.rbenv/versions/2.5.0/bin/unicorn_rails:23:in `<main>'
原因と対策
Unicorn 5.5.0で発生するエラーのようでダウングレードするとエラーが解決しました。
bundle exec gem list | grep unicorn unicorn (5.5.0)
解決策
gemを5.4.1でバージョン指定
group :production, :staging do gem 'unicorn', '5.4.1' end
その後 5.5.0をアンインストール
bundle exec gem uninstall unicorn -v '5.5.0' Successfully uninstalled unicorn-5.5.0
これで解決しました
その他関連記事
Rspecのエラー|ArgumentError is not a valid status
サーバーでNo space left on deviceが発生した場合の対処
can't find gem bundler (>= 0.a) with executable bundle (Gem:
あなたにお勧めの記事
前の記事
2019/08/23
次の記事
2018/09/21