ハッカソンの際に,githubからクローンしてきたrailsのプロジェクトを実行してみたところ,自分だけエラーを吐いて焦った記憶があります.その時は記事にまとめたり記録しておく時間がなかったのですが,再度就活用に動かしてみようと思った際に同じエラーに出会ったので,今回は軽い記事にしておこうと思います.
使用環境
エラー状況
プロジェクト実行時の下記コマンドを実行したところ,
rails s
下記のようなエラーが出力されました.
C:/yourRailsProjectPath/vendor/bundle/ruby/2.5.0/gems/puma-3.12.6/lib/puma/binder.rb:371:in `add_unix_listener': uninitialized constant Puma::Binder::UNIXServer (NameError)
この際,puma.rbファイルは次のようになっています.
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } threads threads_count, threads_count port ENV.fetch("PORT") { 3000 } environment ENV.fetch("RAILS_ENV") { "development" } pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } plugin :tmp_restart bind "unix://#{Rails.root}/tmp/sockets/puma.sock" rails_root = Dir.pwd if Rails.env.production? # 略 end
解決策
windows側のパスの設定が出来ていないようでした. bindの設定を無くしてみただけで,実行できるようになりました.
つまり ↓ でいける.
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } threads threads_count, threads_count port ENV.fetch("PORT") { 3000 } environment ENV.fetch("RAILS_ENV") { "development" } pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } plugin :tmp_restart # bind "unix://#{Rails.root}/tmp/sockets/puma.sock" # 無くても実行できた rails_root = Dir.pwd if Rails.env.production? # 略 end
手抜き記事が多くてすみません.今回は以上.