我刚刚开始维护其他人的代码库,但我无法让它在生产环境中本地运行。预编译样式表时会出现错误。
这是在Ruby 1.9.2上运行的Rails 3.2.6应用程序。我注意到在下面的输出中,gemset被全局使用,这很奇怪,因为当我运行
时rvm gemset list
表示正在使用项目的gemset。我不确定这是否是我的问题的原因,如果它是无关的。
我真的不知道如何解决这个问题。有什么建议吗?
RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/bendowney/.rvm/rubies/ruby-1.9.2-p320/bin/ruby /Users/bendowney/.rvm/gems/ruby-1.9.2-p320@global/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 `each' for true:TrueClass
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/actionpack-3.2.6/lib/sprockets/static_compiler.rb:47:in `compile_path?'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/actionpack-3.2.6/lib/sprockets/static_compiler.rb:22:in `block in compile'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/sprockets-2.1.3/lib/sprockets/base.rb:212:in `block in each_logical_path'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/sprockets-2.1.3/lib/sprockets/base.rb:200:in `block (2 levels) in each_file'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each_entry'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/sprockets-2.1.3/lib/sprockets/base.rb:198:in `block in each_file'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each_file'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/sprockets-2.1.3/lib/sprockets/base.rb:210:in `each_logical_path'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/actionpack-3.2.6/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/actionpack-3.2.6/lib/sprockets/assets.rake:56:in `internal_precompile'
/Users/bendowney/.rvm/gems/ruby-1.9.2-p320@challenge/gems/actionpack-3.2.6/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
答案 0 :(得分:2)
在 environments / production.rb 中,确保您的config.assets.precompile
是一个数组,但未设置为true
。 docs的示例:
config.assets.precompile += ['admin.js', 'admin.css', 'swfObject.js']