预编译rails资产导致未定义的方法目录?为零:NilClass

时间:2015-05-10 08:11:19

标签: ruby-on-rails asset-pipeline assets precompile

我正在尝试在我的rails应用程序中预编译资产,并获得此

$ ber assets:precompile --trace
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
NoMethodError: undefined method `directory?' for nil:NilClass
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/base.rb:307:in `block in each_entry'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/base.rb:303:in `each'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/base.rb:303:in `each_entry'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/base.rb:322:in `block in each_file'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/base.rb:321:in `each'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/base.rb:321:in `each_file'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/base.rb:335:in `each_logical_path'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/manifest.rb:115:in `each'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/manifest.rb:115:in `to_a'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprock
ets/manifest.rb:115:in `compile'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.2.4/lib/s
prockets/rails/task.rb:70:in `block (3 levels) in define'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/rake/s
procketstask.rb:146:in `with_logger'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.2.4/lib/s
prockets/rails/task.rb:69:in `block (2 levels) in define'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.r
b:240:in `call'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.r
b:240:in `block in execute'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.r
b:235:in `each'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.r
b:235:in `execute'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.r
b:179:in `block in invoke_with_call_chain'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.r
b:172:in `invoke_with_call_chain'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.r
b:165:in `invoke'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:150:in `invoke_task'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:106:in `block (2 levels) in top_level'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:106:in `each'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:106:in `block in top_level'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:115:in `run_with_threads'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:100:in `top_level'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:78:in `block in run'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:176:in `standard_exception_handling'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/applic
ation.rb:75:in `run'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in
`<top (required)>'
c:/RailsInstaller/Ruby2.1.0/bin/rake:23:in `load'
c:/RailsInstaller/Ruby2.1.0/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile

1 个答案:

答案 0 :(得分:1)

当我引用application.js.erb中不再存在的目录时,我遇到了同样的错误。它也可能是一个破坏的软链接,可能会导致此错误,但我发现你在Windows上,所以可以排除几乎100%。

检查资产文件,以便在引用其他文件或已存在但已删除的目录的情况下输入错误。