Sass 未定义变量:"$navbar-height" in Rails



我正在尝试预编译资产,但出现以下错误。问题出在 gem 中使用的一个 css 文件。如何解决?

rake aborted!
Sass::SyntaxError: Undefined variable: "$navbar-height".

完整日志:

rake assets:precompile
rake aborted!
Sass::SyntaxError: Undefined variable: "$navbar-height".
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/spree_backend-3.1.4/app/assets/stylesheets/spree/backend/components/_sidebar.scss:3
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/spree_backend-3.1.4/app/assets/stylesheets/spree/backend/spree_admin.css.scss:6
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/script/tree/variable.rb:49:in `_perform'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/script/tree/node.rb:58:in `perform'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/script/tree/operation.rb:64:in `_perform'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/script/tree/node.rb:58:in `perform'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:397:in `visit_prop'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `block in visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:79:in `block in with_base'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:115:in `with_frame'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:79:in `with_base'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:433:in `block (2 levels) in visit_rule'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:433:in `map'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:433:in `block in visit_rule'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:181:in `with_environment'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:431:in `visit_rule'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `block in visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:79:in `block in with_base'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:115:in `with_frame'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:79:in `with_base'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:328:in `block (2 levels) in visit_import'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:328:in `map'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:328:in `block in visit_import'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:88:in `block in with_import'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:115:in `with_frame'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:88:in `with_import'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:325:in `visit_import'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `block in visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:79:in `block in with_base'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:115:in `with_frame'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/stack.rb:79:in `with_base'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:160:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `map'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:169:in `block in visit_children'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:181:in `with_environment'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:168:in `visit_children'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:188:in `visit_root'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:159:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/visitors/perform.rb:8:in `visit'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/root_node.rb:36:in `css_tree'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/tree/root_node.rb:20:in `render'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-3.4.23/lib/sass/engine.rb:281:in `render'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sass-rails-5.0.6/lib/sass/rails/template.rb:47:in `evaluate'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/tilt-2.0.7/lib/tilt/template.rb:109:in `render'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/legacy_tilt_processor.rb:25:in `call'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `yield'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:23:in `block in call'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/utils.rb:200:in `dfs'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:24:in `call'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `yield'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/home/zapbuild/.rvm/gems/ruby-2.2.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/zapbuild/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/home/zapbuild/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile

Gem 文件是:

source 'https://rubygems.org'
ruby '2.2.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.0'
# Use postgresql as the database for Active Record
gem 'pg'
gem 'sass-rails', '>= 3.2'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby
gem 'bourbon'
gem 'nokogiri'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc
# For accessing Amazon's APImini_portile2 2.1.0
gem 'vacuum'
# For calculating fba fees
gem 'fba_fee_calculator'
gem 'factory_girl_rails'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'will_paginate'
gem 'kaminari'
gem 'bootstrap-will_paginate', '~> 0.0.10'
gem 'simple_form'
gem 'country_select'
gem 'paperclip', '~> 4.3'
gem 'carrierwave'
gem 'mini_magick',             '4.5.1'
gem 'fog',                     '1.38.0'
gem 'iconv'
gem 'prawn'
gem 'masonry-rails'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'dotenv-rails', :groups => [:development, :test]
gem 'selenium-webdriver'
gem "rails-erd"
gem "byebug"
gem 'spree', '~> 3.1.0'
gem 'spree_auth_devise', '~> 3.1.0'
gem 'spree_gateway', '~> 3.1.0'
group :production do
  gem 'rails_12factor'
  gem 'sprockets-rails'
end
group :development do
  gem "better_errors"
  gem "binding_of_caller"
end
group :development, :test do
  gem 'rspec-rails'
  gem 'capybara'
  gem 'launchy'
end

尝试转移需要狂欢指令.css在顶部

前任:-

*= require file1
*= require file2
*= require spree.css

自:-

*= require spree.css
*= require file1
*= require file2
变量

很可能被其他一些文件或框架(如bootstrap-sprockets等(覆盖,可能这就是狂欢组件无法读取变量的原因。

最新更新