我是一个相对较新的Rails程序员,当我尝试预编译资产(有时甚至运行服务器)时,我收到此错误:
TypeError: couldn't digest ActiveSupport::StringInquirer
/Users/Lucia/jruby/lib/ruby/gems/shared/gems/sprockets-3.5.2/lib/sprockets/digest_utils.rb:83:in `digest'
/Users/Lucia/jruby/lib/ruby/gems/shared/gems/sprockets-3.5.2/lib/sprockets/loader.rb:55:in `block in load'
/Users/Lucia/jruby/lib/ruby/gems/shared/gems/sprockets-3.5.2/lib/sprockets/loader.rb:312:in `block in fetch_asset_from_dependency_cache'
org/jruby/RubyArray.java:1560:in `each'
org/jruby/RubyEnumerable.java:1016:in `each_with_index'
/Users/Lucia/jruby/lib/ruby/gems/shared/gems/sprockets-3.5.2/lib/sprockets/loader.rb:308:in `fetch_asset_from_dependency_cache'
/Users/Lucia/jruby/lib/ruby/gems/shared/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
...
我尝试在开发过程中关闭摘要,并尝试使用指向开发的RAILS_ENV
标志运行rake任务,但没有结果。
我已经尝试在谷歌上查找此问题,似乎无法找到任何相关内容。
我正在运行jRuby 9.0.5.0
和rails 4.2.5.2
。
答案 0 :(得分:9)
尝试启动这些命令:
RAILS_ENV=test bundle exec rake assets:clean
RAILS_ENV=test bundle exec rake tmp:cache:clear
RAILS_ENV=test bundle exec rake assets:precompile
答案 1 :(得分:7)
对于开发环境,只需删除tmp/cache/assets/
路径
$ rm -rf tmp/cache/assets/