ruby-on-rails - 已将Rails 4升级到Rail 5,现在为#<ActionView::Template::Error:0x007f243ecd5d48>获得 "NoMethodError: undefined method ` original_exception'”

标签 ruby-on-rails ruby-on-rails-5 actionview

如前所述,我通过更新Gemfile中的版本并运行rails app:update将Rails从v4更新到了v5.1.5。每当尝试加载页面时,我都会收到以下错误,该错误使服务器崩溃:

    ActionView::Template::Error ($map2: (3rem 2.5rem 2rem 1.5rem 1.25rem 1rem 0.75rem) is not a map for `map-merge'):
    19:     src="https://maps.googleapis.com/maps/api/js?key=<%= ENV["GOOGLE_MAPS_KEY"]%>&callback=initMap"
    20:     type="text/javascript">
    21:    </script>
    22:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
    23:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    24:   <%= csrf_meta_tags %>
    25: </head>

app/assets/stylesheets/application.scss:18
app/views/layouts/application.html.erb:22:in `_app_views_layouts_application_html_erb__2123457921920629012_70201480953880'

NoMethodError: undefined method `original_exception' for #<ActionView::Template::Error:0x007fb21c9d6068>
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:16:in `block in render_exception_with_web_console'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:3:in `tap'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:3:in `render_exception_with_web_console'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:69:in `rescue in call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:58:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:20:in `block in call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `catch'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:36:in `call_app'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:24:in `block in call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:69:in `block in tagged'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:26:in `tagged'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:69:in `tagged'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:24:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/request_id.rb:25:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/method_override.rb:22:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/runtime.rb:22:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/executor.rb:12:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/static.rb:125:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/engine.rb:522:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/handler/webrick.rb:86:in `service'
        from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
        from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
        from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
10.240.1.50 - - [06/Apr/2018:06:01:47 UTC] "GET / HTTP/1.1" 500 1477
- -> /
10.240.1.30 - - [06/Apr/2018:06:01:50 UTC] "GET /favicon.ico HTTP/1.1" 200 0
http://traid-emikaijuin.c9users.io/ -> /favicon.ico

我发现了一个类似的帖子,该帖子与默认的application.scss和application.js有关,它们需要尚未创建的目录,但不适用于我的情况。

这是application.html.erb的开头:
<!DOCTYPE html>
<html>
<head>
  <title>Workspace</title>

  <link 
    href="https://fonts.googleapis.com/css?family=Raleway:200,400,700,800" 
    rel="stylesheet">
  <script
    src="https://code.jquery.com/jquery-3.3.1.js"
    integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
    crossorigin="anonymous"></script>
  <script 
    defer 
    src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
   <script 
    async 
    defer 
    src="https://maps.googleapis.com/maps/api/js?key=<%= ENV["GOOGLE_MAPS_KEY"]%>&callback=initMap"
    type="text/javascript">
   </script>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>

和我的application.scss
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_tree .
 *= require_self
 */
@import "bulma";
@import "bootstrap";

// html {
//     background-color: rgba(107,186,167,0.3);
// }

// body{
// }

最佳答案

您的网络控制台gem已过期。

尝试删除Gemfile中的所有版本限制:
gem web-console
然后使用
bundle update web-console

关于ruby-on-rails - 已将Rails 4升级到Rail 5,现在为#<ActionView::Template::Error:0x007f243ecd5d48>获得 "NoMethodError: undefined method ` original_exception'”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49686388/

相关文章:

ruby-on-rails-5 - 使用 STI 时,Rails 5.0 不获取多态关联

ruby-on-rails - Ruby——自动初始化子类的类实例变量,不继承值

android - 如何使 Toolbar 上的 SearchView 始终展开?

android - 我可以在调用 Intent.ACTION_VIEW 时禁用某个选项吗?

ruby-on-rails - 在 Ruby 中下载的 Google 文档的路径在哪里?

ruby-on-rails - 是否有一些 Ruby on Rails 方法可以将模型对象转换为 HASH 结构?

ruby-on-rails - 如何更改 Rails 中的默认单词?

ruby-on-rails - rails simple_nested_form_for fields_for 错误数量的参数

ruby-on-rails - 如何让 Rake 任务在我的 Sinantra 应用程序/环境下运行?

javascript - 使用 javascript 在 Rails 中自动返回 API 请求值