加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – ArgumentError(Api :: V1的副本已从模块树中删

发布时间:2020-12-17 02:57:17 所属栏目:百科 来源:网络整理
导读:我几天来一直在努力解决这个问题.我有一个应用程序,我正在构建一些API,上面提到的错误总是在第一次运行时崩溃我的应用程序.重新加载应用程序时错误消失,但它仍然很烦人.以下是一些有关此错误的类似问题: A copy of xxx has been removed from the module tr
我几天来一直在努力解决这个问题.我有一个应用程序,我正在构建一些API,上面提到的错误总是在第一次运行时崩溃我的应用程序.重新加载应用程序时错误消失,但它仍然很烦人.以下是一些有关此错误的类似问题:

A copy of xxx has been removed from the module tree but is still active

ArgumentError: A copy of ApplicationController has been removed from the module tree but is still active

这两个链接都没有解决我面临的问题.这是完整的堆栈跟踪:

ArgumentError (A copy of Api::V1 has been removed from the module tree but is still active!):
activesupport (5.1.4) lib/active_support/dependencies.rb:495:in `load_missing_constant'
activesupport (5.1.4) lib/active_support/dependencies.rb:202:in `const_missing'
activesupport (5.1.4) lib/active_support/inflector/methods.rb:271:in `const_get'
activesupport (5.1.4) lib/active_support/inflector/methods.rb:271:in `block in constantize'
activesupport (5.1.4) lib/active_support/inflector/methods.rb:267:in `each'
activesupport (5.1.4) lib/active_support/inflector/methods.rb:267:in `inject'
activesupport (5.1.4) lib/active_support/inflector/methods.rb:267:in `constantize'
activesupport (5.1.4) lib/active_support/dependencies.rb:582:in `get'
activesupport (5.1.4) lib/active_support/dependencies.rb:613:in `constantize'
actionpack (5.1.4) lib/action_dispatch/http/request.rb:85:in `controller_class_for'
actionpack (5.1.4) lib/action_dispatch/http/parameters.rb:99:in `binary_params_for?'
actionpack (5.1.4) lib/action_dispatch/http/parameters.rb:90:in `set_binary_encoding'
actionpack (5.1.4) lib/action_dispatch/http/parameters.rb:67:in `path_parameters='
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:48:in `block in serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:834:in `call'
bullet (5.7.5) lib/bullet/rack.rb:14:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.5) lib/rack/etag.rb:25:in `call'
rack (2.0.5) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.5) lib/rack/head.rb:12:in `call'
rack (2.0.5) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.5) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.4) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.4) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.4) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
airbrake (7.3.0) lib/airbrake/rack/middleware.rb:52:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.6.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.6.1) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.6.1) lib/web_console/middleware.rb:20:in `catch'
web-console (3.6.1) lib/web_console/middleware.rb:20:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.4) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.4) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.4) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.5) lib/rack/method_override.rb:22:in `call'
rack (2.0.5) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.5) lib/rack/sendfile.rb:111:in `call'
rack-mini-profiler (1.0.0) lib/mini_profiler/profiler.rb:285:in `call'
webpacker (3.4.3) lib/webpacker/dev_server_proxy.rb:18:in `perform_request'
rack-proxy (0.6.4) lib/rack/proxy.rb:57:in `call'
railties (5.1.4) lib/rails/engine.rb:522:in `call'
puma (3.11.4) lib/puma/configuration.rb:225:in `call'
puma (3.11.4) lib/puma/server.rb:632:in `handle_request'
puma (3.11.4) lib/puma/server.rb:446:in `process_client'
puma (3.11.4) lib/puma/server.rb:306:in `block in run'
puma (3.11.4) lib/puma/thread_pool.rb:120:in `block in spawn_thread'

解决方法

正如堆栈跟踪所示,这是应用程序与ActiveSupport的依赖性冲突.我建议使用gem bootsnap.Bootsnap首先覆盖导致问题的ActiveSupport :: Dependencies.它还改善了应用程序的加载时间,这实际上是它的设计目标.从 Bootsnap文件:

ActiveSupport::Dependencies.{autoloadable_module?,load_missing_constant,depend_on} are overridden to eliminate scans of ActiveSupport::Dependencies.autoload_paths.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读