相关疑难解决方法(0)

rake assets:预编译未定义的方法目录?为零:NilClass

在尝试创建资产时:为生产网站预编译我第一次遇到此错误.

 rake assets:precompile undefined method directory? for nil:NilClass
Run Code Online (Sandbox Code Playgroud)

我已经成功更新了网站并完成了一项资产:之前多次预编译.

完整的例子:

# RAILS_ENV=production rake assets:precompile --trace                        
/usr/local/rvm/gems/ruby-1.9.2-p290@pm/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
/usr/local/rvm/gems/ruby-1.9.2-p290@pm/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
rake aborted!
undefined method `directory?' for nil:NilClass

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)

我期待着有人对这一点有所了解,我一直在绞尽脑汁,谷歌搜索答案数小时.

rake ruby-on-rails-3 asset-pipeline

11
推荐指数
2
解决办法
4131
查看次数

为什么'rake资产:预编译'给'NoMethodError:未定义的方法[]为nil:NilClass'?

我正在尝试使用Capistrano部署项目,但我收到了这个错误.

当我直接在服务器上运行命令时,会发生同样的事情.以下是输出/opt/rbenv/shims/bundle exec rake assets:precompile --trace

** 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 `[]' for nil:NilClass
[snip]/shared/bundle/ruby/2.2.0/gems/less-rails-2.6.0/lib/less/rails/template_handlers.rb:37:in `config_paths'
[snip]/shared/bundle/ruby/2.2.0/gems/less-rails-2.6.0/lib/less/rails/template_handlers.rb:26:in `config_to_less_parser_options'
[snip]/shared/bundle/ruby/2.2.0/gems/less-rails-2.6.0/lib/less/rails/template_handlers.rb:17:in `evaluate'
[snip]/shared/bundle/ruby/2.2.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/legacy_tilt_processor.rb:25:in `call'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/processor_utils.rb:73:in `call_processor'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/processor_utils.rb:55:in `block in call_processors'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/processor_utils.rb:54:in `reverse_each'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/processor_utils.rb:54:in `call_processors'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/loader.rb:103:in `load_asset_by_uri'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/loader.rb:40:in `block in load'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/loader.rb:170:in `fetch_asset_from_dependency_cache'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/loader.rb:33:in `load'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/cached_environment.rb:47:in `yield'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/cached_environment.rb:47:in `load'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/bundle.rb:23:in `block in call'
[snip]/shared/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/utils.rb:183:in `dfs' …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

0
推荐指数
1
解决办法
1213
查看次数