ruby on Rails(初始化':错误的参数数(给定3,预期2)(grighterror))

发布于 2025-01-22 09:16:18 字数 5114 浏览 3 评论 0原文

试图编译15年历史的Ruby网站时,我一直在遇到此错误。

=> Rails 5.1.7 application starting in development
=> Run `rails server -h` for more startup options
Exiting
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/static.rb:109:in `initialize': wrong number of arguments (given 3, expected 2) (ArgumentError)
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:35:in `new'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:35:in `build'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `block in build'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `each'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `inject'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `build'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/engine.rb:508:in `block in app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/engine.rb:504:in `synchronize'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/engine.rb:504:in `app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/application/finisher.rb:45:in `block in <module:Finisher>'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `instance_exec'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `run'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/initializable.rb:59:in `block in run_initializers'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `call'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/initializable.rb:58:in `run_initializers'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/application.rb:353:in `initialize!'
    from C:/Sites/Greyville/config/environment.rb:5:in `<top (required)>'
    from config.ru:3:in `require_relative'
    from config.ru:3:in `block in <main>'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:24:in `app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:42:in `start'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:135:in `block in perform'
    from <internal:kernel>:90:in `tap'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `perform'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/command/base.rb:63:in `perform'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/command.rb:44:in `invoke'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

知道我如何解决吗?它是过去的Ruby 3,所以不使用Ruby 2。如果我使用Ruby 3,则会出现此错误。如果我使用Ruby 2,则更多的错误。

I keep getting this error when trying to compile a 15 year old Ruby site.

=> Rails 5.1.7 application starting in development
=> Run `rails server -h` for more startup options
Exiting
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/static.rb:109:in `initialize': wrong number of arguments (given 3, expected 2) (ArgumentError)
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:35:in `new'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:35:in `build'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `block in build'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `each'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `inject'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `build'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/engine.rb:508:in `block in app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/engine.rb:504:in `synchronize'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/engine.rb:504:in `app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/application/finisher.rb:45:in `block in <module:Finisher>'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `instance_exec'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `run'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/initializable.rb:59:in `block in run_initializers'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `call'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/initializable.rb:58:in `run_initializers'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/application.rb:353:in `initialize!'
    from C:/Sites/Greyville/config/environment.rb:5:in `<top (required)>'
    from config.ru:3:in `require_relative'
    from config.ru:3:in `block in <main>'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:24:in `app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:42:in `start'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:135:in `block in perform'
    from <internal:kernel>:90:in `tap'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `perform'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/command/base.rb:63:in `perform'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/command.rb:44:in `invoke'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Any idea how I may fix? It's past Ruby 3, so not using Ruby 2. If I use Ruby 3 it comes up with this error. If I use Ruby 2, it's a lot more errors.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文