Techioz Blog

また、~/.rvmrc で rvm_configure_flags を設定すると、それらのオプションを ./configure ステップに渡すという意図した効果があることも確認しました。

概要

Rails アプリケーションを React に接続しようとしています。設定はほぼ完了していますが、./bin/dev コマンドを実行するたびに次のエラーが発生します。

誰かこれについて手伝ってくれませんか?私がしていないことは何ですか?

$ ./bin/dev
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/process.rb:54:in `spawn': Exec format error - 
bin/rails server -p 3000 (Errno::ENOEXEC)

./bin/dev
Installing foreman...
Fetching foreman-0.87.2.gem
Successfully installed foreman-0.87.2
Parsing documentation for foreman-0.87.2
Installing ri documentation for foreman-0.87.2
Done installing documentation for foreman after 3 seconds
1 gem installed
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/process.rb:54:in `spawn': Exec format error - bin/rails server -p 3000 (Errno::ENOEXEC)
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/process.rb:54:in `block in run'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/process.rb:53:in `chdir'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/process.rb:53:in `run'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/engine.rb:367:in `block (2 levels) in spawn_processes'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/engine.rb:364:in `upto'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/engine.rb:364:in `block in spawn_processes'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/engine.rb:363:in `each'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/engine.rb:363:in `spawn_processes'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/engine.rb:57:in `start'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/cli.rb:42:in `start'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/vendor/thor/lib/thor/command.rb:27:in `run'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/vendor/thor/lib/thor.rb:369:in `dispatch'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/lib/foreman/vendor/thor/lib/thor/base.rb:444:in `start'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/foreman-0.87.2/bin/foreman:7:in `<top (required)>'
        from C:/Ruby31-x64/bin/foreman:32:in `load'
        from C:/Ruby31-x64/bin/foreman:32:in `<main>'

プロフィール.dev

Procfile.dev

解決策

私にとっては、Procfile部分から「bin/」を削除するとうまくいきました こんな感じでした

web: rails server -p 3000
js: yarn build watch

標準の Rails サーバーを実行するのと同じです