ruby-on-rails – Rails 3.1.1资源预编译 – rake中止

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails 3.1.1资源预编译 – rake中止前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
编辑:还有其他任何建议吗?我完全被骗了!

我有一个应用程序,其中所有的资产编译很好,但在这第二个应用程序,当我运行:

RAILS_ENV=production rake assets:precompile --trace

我收到以下消息:undefined方法`目录?’为nil:NilClass

请帮忙.当我查看公共/资产目录下时,我看到图像文件已被预编译,但没有js或css文件.

以下是完整的终端输出

=> RAILS_ENV=production rake assets:precompile --trace
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/swamiatma/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
** 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 environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
undefined method `directory?' for nil:NilClass
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/sprockets-2.0.2/lib/sprockets/base.rb:122:in `block in each_entry'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/sprockets-2.0.2/lib/sprockets/base.rb:118:in `each'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/sprockets-2.0.2/lib/sprockets/base.rb:118:in `each_entry'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/sprockets-2.0.2/lib/sprockets/base.rb:137:in `block in each_file'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/sprockets-2.0.2/lib/sprockets/base.rb:136:in `each'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/sprockets-2.0.2/lib/sprockets/base.rb:136:in `each_file'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/sprockets-2.0.2/lib/sprockets/base.rb:149:in `each_logical_path'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/actionpack-3.1.1/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/actionpack-3.1.1/lib/sprockets/assets.rake:52:in `internal_precompile'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/actionpack-3.1.1/lib/sprockets/assets.rake:66:in `block (3 levels) in <top (required)>'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/swamiatma/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/actionpack-3.1.1/lib/sprockets/assets.rake:56:in `block (3 levels) in <top (required)>'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/swamiatma/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/bin/rake:19:in `load'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command Failed with status (1): [/Users/swamiatma/.rvm/rubies/ruby-1.9.2-p2...]
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `call'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `sh'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `sh'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils.rb:78:in `ruby'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `ruby'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/actionpack-3.1.1/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/actionpack-3.1.1/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/gems/actionpack-3.1.1/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/swamiatma/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/bin/rake:19:in `load'
/Users/swamiatma/.rvm/gems/ruby-1.9.2-p290@lasource/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile

解决方法

感谢phoet:我刚刚在.bundle / ruby​​ / 1.9.1 / gems / sprockets-2.0.2 / lib / sprockets / base.rb上用一个begin..rescue块包围了这些行.错误是由无效的符号链接引起的(仅在生产环境中使用导轨3.1.1链轮2.0.2,另外机架1.3.4导致恒定的WFKV_警告,但机架1.3.3不)
120  paths << path
121  begin
122    if stat(path).directory?
123      each_entry(path) do |subpath|
124        paths << subpath
125      end
126    end
127  rescue
128    puts "error with directory #{path}"
129  end

现在错误已经消失,捆绑exec rake资产:precompile –trace结束,但需要在最后两个步骤永恒**执行资产:precompile:主要在tmp之后:缓存:清除…我们将看到;)

原文链接:https://www.f2er.com/ruby/267217.html

猜你在找的Ruby相关文章