首页 > 解决方案 > 更新 Ruby 后意外 = 在 haml 文件中

问题描述

我正在运行一个 rails 应用程序(rails:4.2 和 ruby​​ 2.2.3)。我正在尝试将我的 ruby​​ 更新到 2.4.4 并且能够成功运行捆绑安装。但是,当我启动服务器并转到我的应用程序的主页时,我在 application.html.haml 文件中遇到了这个行的意外 =: = favicon_link_tag 'favicon.ico' 这里有人遇到过这样的错误吗?

PS如果这个问题之前已经发布过,有人可以将我重定向到它,因为我找不到这个问题。

   %head

    %base{:href => "/dashboard"}
    %title Title Page
    = favicon_link_tag 'favicon.ico'
    = stylesheet_link_tag "application", :media => nil
    = javascript_include_tag "application"
    = csrf_meta_tags

  %body{'ng-app'=>'thumper','ng-controller'=>'MainController'}
    - if signed_in?
      .navbar.navbar-inverse.navbar-fixed-top{:style => 'padding-top:0px;height: 30px;'}
        .container
          %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse"}
          %a.navbar-brand{:href => "/", :target => "_self"}
            = image_tag "main_image.png", :style => 'width:65px;', :alt => 'company_name'

          .navbar-collapse.collapse
            %ul.nav.navbar-nav
              %li
                %a{:href => "/faq", :target => "_self"}
                  %i.fa.fa-lightbulb-o
                  FAQ
              %li

这是我的 application.html.haml 文件的初始部分。我收到以下错误:

DEPRECATED: Please use restforce (https://github.com/ejholmes/restforce) instead.
=> Booting Thin
=> Rails 4.2.11 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop


Started GET "/testpage" for 127.0.0.1 at 2019-03-12 09:32:47 -0500
  ActiveRecord::SchemaMigration Load (44.9ms)  SELECT `schema_migrations`.* FROM `schema_migrations`
Processing by TestController#foo as HTML
HERE
  Rendered test/foo.html within layouts/application (2.9ms)
Completed 500 Internal Server Error in 1964ms (ActiveRecord: 0.0ms)

ExecJS::RuntimeError - SyntaxError: [stdin]:959:20: unexpected =:
  app/views/layouts/application.html.haml:7:in `_app_views_layouts_application_html_haml___861496224579637971_70314333220700'
  app/lib/cors.rb:12:in `call'
  app/lib/cors.rb:12:in `call'



Started POST "/__better_errors/1f18681361fed4ae/variables" for 127.0.0.1 at 2019-03-12 09:32:50 -0500

Web 浏览器如下所示:

在此处输入图像描述

标签: ruby-on-railsrubyhaml

解决方案


推荐阅读