gpt4 book ai didi

css - Assets :precompile throws error: undefined method `each' for true:TrueClass

转载 作者:行者123 更新时间:2023-11-28 13:29:20 27 4
gpt4 key购买 nike

我刚刚开始维护其他人的代码库,但我无法让它在生产环境中本地运行。预编译样式表时会出现错误。

这是一个在 Ruby 1.9.2 上运行的 Rails 3.2.6 应用程序。我注意到在下面的输出中,gemset 被全局使用,这很奇怪,因为当我运行

rvm gemset 列表

表示正在使用元素的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)>'

最佳答案

在您的 environments/production.rb 中,确保您的 config.assets.precompile 是一个数组并且未设置为 true。来自 docs 的示例:

config.assets.precompile += ['admin.js', 'admin.css', 'swfObject.js']

关于css - Assets :precompile throws error: undefined method `each' for true:TrueClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12433889/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com