0

我正在使用ruby 3.1.0p0Rails 7.0.1。我最近从Rails 6.1和升级ruby 2.7

当我在本地托管网站时,我没有遇到任何问题。但是,当我将站点部署到Ubuntu 20.04服务器时nginx v1.18.0,站点无法加载,并且出现以下错误:

NoMethodError: undefined method `glob?' for nil:NilClass
 path.ast.glob?

它出现在 [GEM_ROOT]/gems/actionpack-7.0.1/lib/action_dispatch/journey/route.rb:138:in `glob?' 的第 138 行

有没有人遇到过这样的情况?这似乎真的很奇怪,我不知道我需要做什么来解决它。

编辑:

我决定在本地测试登台和生产。如果我做

RAILS_ENV=staging bin/rails s或者 RAILS_ENV=production bin/rails s

我的本地机器上也发生了同样的错误。所以有些事情只会在它不在开发环境中运行时发生。

完整的堆栈跟踪是:

I, [2022-01-24T05:42:38.843002 #29967]  INFO -- : [d3fbd988-67a8-461f-8d7f-26f83a67426f] Started GET "/" for 23.81.176.249 at 2022-01-24 05:42:38 -0800
I, [2022-01-24T05:42:38.843604 #29967]  INFO -- : [d3fbd988-67a8-461f-8d7f-26f83a67426f] Processing by HomeController#landing as HTML
F, [2022-01-24T05:42:38.846258 #29967] FATAL -- : [d3fbd988-67a8-461f-8d7f-26f83a67426f]
[d3fbd988-67a8-461f-8d7f-26f83a67426f] NoMethodError (undefined method `glob?' for nil:NilClass

        path.ast.glob?
                ^^^^^^):
[d3fbd988-67a8-461f-8d7f-26f83a67426f]
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/journey/route.rb:138:in `glob?'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] airbrake (12.0.0) lib/airbrake/rails/app.rb:48:in `block (2 levels) in recognize_route'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/journey/router.rb:74:in `block in recognize'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/journey/router.rb:66:in `each'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/journey/router.rb:66:in `recognize'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] airbrake (12.0.0) lib/airbrake/rails/app.rb:35:in `block in recognize_route'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] airbrake (12.0.0) lib/airbrake/rails/app.rb:34:in `each'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] airbrake (12.0.0) lib/airbrake/rails/app.rb:34:in `recognize_route'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] airbrake (12.0.0) lib/airbrake/rails/action_controller_route_subscriber.rb:20:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications/fanout.rb:236:in `finish'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications/fanout.rb:76:in `block in finish'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications/fanout.rb:91:in `block in iterate_guarding_exceptions'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications/fanout.rb:90:in `each'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications/fanout.rb:90:in `iterate_guarding_exceptions'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications/fanout.rb:76:in `finish'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications/instrumenter.rb:49:in `finish_with_state'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications/instrumenter.rb:30:in `instrument'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/notifications.rb:206:in `instrument'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_controller/metal/instrumentation.rb:64:in `process_action'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activerecord (7.0.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/abstract_controller/base.rb:151:in `process'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionview (7.0.1) lib/action_view/rendering.rb:39:in `process'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_controller/metal.rb:188:in `dispatch'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_controller/metal.rb:251:in `dispatch'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/journey/router.rb:32:in `each'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/journey/router.rb:32:in `serve'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/routing/route_set.rb:850:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/etag.rb:27:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/conditional_get.rb:27:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/head.rb:12:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/cookies.rb:693:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/callbacks.rb:99:in `run_callbacks'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] airbrake (12.0.0) lib/airbrake/rack/middleware.rb:34:in `call!'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] airbrake (12.0.0) lib/airbrake/rack/middleware.rb:23:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] railties (7.0.1) lib/rails/rack/logger.rb:36:in `call_app'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] railties (7.0.1) lib/rails/rack/logger.rb:25:in `block in call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/tagged_logging.rb:99:in `block in tagged'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/tagged_logging.rb:37:in `tagged'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] activesupport (7.0.1) lib/active_support/tagged_logging.rb:99:in `tagged'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] railties (7.0.1) lib/rails/rack/logger.rb:25:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/method_override.rb:24:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/runtime.rb:22:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] actionpack (7.0.1) lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] honeybadger (4.10.0) lib/honeybadger/rack/error_notifier.rb:33:in `block in call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] honeybadger (4.10.0) lib/honeybadger/agent.rb:426:in `with_rack_env'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] honeybadger (4.10.0) lib/honeybadger/rack/error_notifier.rb:30:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] honeybadger (4.10.0) lib/honeybadger/rack/user_feedback.rb:31:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] honeybadger (4.10.0) lib/honeybadger/rack/user_informer.rb:21:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] railties (7.0.1) lib/rails/engine.rb:530:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] puma (5.5.2) lib/puma/configuration.rb:249:in `call'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] puma (5.5.2) lib/puma/request.rb:77:in `block in handle_request'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] puma (5.5.2) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] puma (5.5.2) lib/puma/request.rb:76:in `handle_request'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] puma (5.5.2) lib/puma/server.rb:447:in `process_client'
[d3fbd988-67a8-461f-8d7f-26f83a67426f] puma (5.5.2) lib/puma/thread_pool.rb:147:in `block in spawn_thread'
4

0 回答 0