我已经尝试找出这个错误很长一段时间了,但没有成功。我正在努力将遗留应用程序升级到最新版本的 ruby 和 Rails。目前我希望让应用程序像 ruby 2.2.0 一样运行 |导轨 4.2.5。我无法在代码库中找到错误。
当我运行
rails s
时,应用程序启动并导航到 localhost:3000,我看到的第一件事是下面的错误。
当前错误
Sass::SyntaxError - Invalid CSS after "...ass}: #{$value}": expected "{", was ";":
第 6 行存在指示错误:
app/views/layouts/application.html.haml
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
运行导轨
user@user-2 effort-forecaster % rails s
=> Booting Puma
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Puma 2.15.3 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:3000
Started GET "/" for 127.0.0.1 at 2022-06-01 14:20:58 -0700
ActiveRecord::SchemaMigration Load (1.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by WelcomeController#index as HTML
User Load (1.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]]
Rendered welcome/index.html.haml within layouts/application (3.0ms)
Completed 500 Internal Server Error in 871ms (ActiveRecord: 16.6ms)
Sass::SyntaxError - Invalid CSS after "...ass}: #{$value}": expected "{", was ";":
application.html.haml
!!!
%html
%head
%title EffortForecast
= javascript_include_tag "//www.google.com/jsapi", "chartkick"
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
%body
= render 'layouts/login_modal'
%section
= render 'layouts/header'
= content_for :subnav
%section.container-fluid
.flash-messages= render 'layouts/flash_messages'
= yield
application.css
/*
* 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 vendor/assets/stylesheets of plugins, if any, 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 bootstrap
*= require jasny-bootstrap
*= require font-awesome
*= require rails_bootstrap_forms
*= require datatables
*= require datatables-fixedcolumns
*= require_tree .
*= require_self
*/
我尝试搜索代码中错误的每个部分,看看它是否在应用程序中的任何位置弹出,但没有成功。任何帮助将不胜感激。
我遇到了同样的问题,我用这个解决了:
rails assets:precompile