2013-08-20 41 views
2

我不得不強制在'3.3.2'版本上創建gem鎖以消除以下錯誤。Select2導致未定義的方法'[]'爲nil:NilClass in application.css.scss

undefined method `[]' for nil:NilClass 
    (in /home/funk/rails_projects/goodsounds.org/app/assets/stylesheets/application.css.scss) 

從我application.css.scss去除*= require select2後,我沒有錯誤,但不幸的是,這不是一個解決方案,我需要使用寶石。

請幫忙。我需要升級!

MY application.css.scss文件

/* 
*= require dataTables/jquery.dataTables.bootstrap 
*= require select2 
*= require chosen 
*= require font-awesome 
*= require ajax_pagination 
*= require_self 
*= require_tree . 
*/ 

@import 'bootstrap'; 
@import 'bootstrap-responsive'; 
@import "font-awesome"; 

完整跟蹤

rake assets:precompile --trace 
** Invoke assets:precompile (first_time) 
** Execute assets:precompile 
/home/funk/.rvm/rubies/ruby-1.9.3-p374/bin/ruby /home/funk/.rvm/gems/[email protected]/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace 
** Invoke assets:precompile:all (first_time) 
** Execute assets:precompile:all 
** Invoke assets:precompile:primary (first_time) 
** Invoke assets:environment (first_time) 
** Execute assets:environment 
** Invoke tmp:cache:clear (first_time) 
** Execute tmp:cache:clear 
** Execute assets:precompile:primary 
rake aborted! 
undefined method `[]' for nil:NilClass 
    (in /home/funk/rails_projects/goodsounds.org/app/assets/stylesheets/application.css.scss) 
/home/funk/.rvm/gems/[email protected]/gems/sass-rails-3.2.6/lib/sass/rails/helpers.rb:32:in `resolver' 
/home/funk/.rvm/gems/[email protected]/gems/sass-rails-3.2.6/lib/sass/rails/helpers.rb:25:in `image_url' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/script/funcall.rb:112:in `_perform' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/script/node.rb:40:in `perform' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/script/list.rb:70:in `block in _perform' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/script/list.rb:70:in `map' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/script/list.rb:70:in `_perform' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/script/node.rb:40:in `perform' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:298:in `visit_prop' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:37:in `visit' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:100:in `visit' 
/home/funk/.rvm/gems/ruby-1.9.3-p374[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in `block in visit_children' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in `map' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in `visit_children' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:109:in `block in visit_children' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:121:in `with_environment' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:108:in `visit_children' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:37:in `block in visit' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:320:in `visit_rule' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:37:in `visit' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:100:in `visit' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in `block in visit_children' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in `map' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:53:in `visit_children' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:109:in `block in visit_children' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:121:in `with_environment' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:108:in `visit_children' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:37:in `block in visit' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:128:in `visit_root' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/base.rb:37:in `visit' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:100:in `visit' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/visitors/perform.rb:7:in `visit' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/tree/root_node.rb:20:in `render' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/engine.rb:315:in `_render' 
/home/funk/.rvm/gems/[email protected]/gems/sass-3.2.10/lib/sass/engine.rb:262:in `render' 
/home/funk/.rvm/gems/[email protected]/gems/sass-rails-3.2.6/lib/sass/rails/compressor.rb:12:in `compress' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/compressors.rb:74:in `compress' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processing.rb:243:in `block in css_compressor=' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `call' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `evaluate' 
/home/funk/.rvm/gems/[email protected]/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:26:in `initialize' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new' 
/home/funk/.rvm/gems/ruby-1.9.3-[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:19:in `block in compile' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file' 
/home/funk/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:18:in `compile' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:56:in `internal_precompile' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:236:in `call' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:231:in `each' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain' 
/home/funk/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:236:in `call' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:231:in `each' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain' 
/home/funk/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:106:in `each' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:75:in `run' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/bin/rake:33:in `<top (required)>' 
/home/funk/.rvm/gems/[email protected]/bin/rake:23:in `load' 
/home/funk/.rvm/gems/[email protected]/bin/rake:23:in `<main>' 
Tasks: TOP => assets:precompile:primary 
rake aborted! 
Command failed with status (1): [/home/funk/.rvm/rubies/ruby-1.9.3-p374/bin...] 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/file_utils.rb:55:in `block in create_shell_runner' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/file_utils.rb:45:in `call' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/file_utils.rb:45:in `sh' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/file_utils_ext.rb:37:in `sh' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/file_utils.rb:82:in `ruby' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/file_utils_ext.rb:37:in `ruby' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:12:in `ruby_rake_task' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task' 
/home/funk/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:236:in `call' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:231:in `each' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain' 
/home/funk/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:106:in `each' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/lib/rake/application.rb:75:in `run' 
/home/funk/.rvm/gems/[email protected]/gems/rake-10.1.0/bin/rake:33:in `<top (required)>' 
/home/funk/.rvm/gems/r[email protected]/bin/rake:23:in `load' 
/home/funk/.rvm/gems/[email protected]/bin/rake:23:in `<main>' 
/home/funk/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `eval' 
/home/funk/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `<main>' 
Tasks: TOP => assets:precompile 

回答

1

說不上來,如果你還是堅持了這個問題,但它是一個紅寶石薩斯bug

我的解決辦法是改變選擇2 css文件到.erb,並更換所有資產的URL

url(<%= asset_path "..." %>) 
+0

的問題(我認爲)是紅寶石薩斯無法解析'圖像url' 。你可以從'image-url'到'url'或任何需要的輔助對象進行搜索和替換。 – varatis

+2

引用的錯誤是兩年前關閉的。我在Rails 4.0和最新的rails-sass中看到了同樣的錯誤。 – DogEatDog

+1

我也看到這個問題。任何關於做什麼的消息? – Kyle

相關問題