我正在处理一个遗留的Rails 3.2.8项目,当运行该项目时,我得到:
ActionView::Template::Error (uninitialized constant Sass::Engine
(in /Users/sergiotapia/Documents/Work/foobar/app/assets/stylesheets/application.css.scss)):
2: <html>
3: <head>
4: <title>Foobar</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1845727542545946075_70110608859600'
]
Rendered vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms)
Rendered vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (7.3ms)
我的Gemfile是这样的,bundle install
运行时没有任何问题。我还可以完美地迁移我的数据库:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'sass-rails', '~> 3.2.3'
# Used by Twitter Bootstrap and/or Font Awesome
gem 'therubyracer'
gem 'bootstrap-sass', '~> 2.2.2.0'
gem 'font-awesome-sass-rails'
end
gem 'jquery-rails'
gem 'devise' # Devise must be required before RailsAdmin
gem 'rails_admin', '0.4.3'
gem "cancan" # Allows us to disable Create and Delete actions for SiteSettings
gem "paperclip", "3.3.0" # Used for file uploads for ad Creatives
gem 'mysql2'
gem 'ruby-mysql'
gem 'useragent' # Allwos for easy detection of iOS devices
gem 'rmagick' # Dynamic e-carrd image generation
为什么Rails显示此错误?
我也遇到了这个问题。我通过解决了这个问题
- 将"sass rails"从资产组中删除
- 手动添加"sass"宝石:
gem 'sass', '3.2.19'
- 我也在使用"波旁威士忌",在这个过程中,我还必须从:assets组中取出它,并将其修复到3.1.8版本
我使用的haml版本也是3.1.8。
请尝试从Gemfile中的group :asset
块中取出gem 'sass-rails', '~> 3.2.3'
。
gem 'sass-rails', '~> 3.2.3'
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
# Used by Twitter Bootstrap and/or Font Awesome
gem 'therubyracer'
gem 'bootstrap-sass', '~> 2.2.2.0'
gem 'font-awesome-sass-rails'
end
# Other gems