【问题标题】:How to solve this " `spawn': Exec format error - bin/rails server -p 3000 (Errno::ENOEXEC)" in Rails如何解决这个 \" `spawn\': Exec format error - bin/rails server -p 3000 (Errno::ENOEXEC)\" 在 Rails
【发布时间】:2022-11-09 23:18:39
【问题描述】:

我正在尝试将我的 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>'

Profile.dev

Procfile.dev

【问题讨论】:

  • 你好 !你能检查一下 config/webpack 是否存在,所有 node_modules 都捆绑了吗?
  • 不,我找不到配置/webpack。它不在那里。 @SarahB
  • 这似乎是调用链中某处的错误。您可以发布完整的错误消息(所有行),还是只有这一行?在任何情况下,最有可能应该被报告为错误的东西是我的猜测。
  • @Casper我认为这与我的红宝石版本和导轨有关。我不得不卸载它们并重新安装。当我想使用.bin/dev 为应用程序提供服务时,我再次遇到以下错误:我已更新问题以包含我遇到的错误。
  • ...你可以直接运行bin/rails server 吗?

标签: reactjs ruby-on-rails ruby liiptestfixturesbundle


【解决方案1】:

对我来说,从 Procfile 部分中删除“bin/”是有效的
看起来像这样

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

就像我运行标准 Rails 服务器一样

【讨论】:

    猜你喜欢
    • 2020-02-23
    • 1970-01-01
    • 1970-01-01
    • 2017-08-02
    • 1970-01-01
    • 2023-01-19
    • 2012-12-11
    • 2019-08-11
    • 2018-07-20
    相关资源
    最近更新 更多