推入Heroku时,链轮抛出NoMethodError

tag5nh1u  于 2022-12-04  发布在  其他
关注(0)|答案(1)|浏览(76)

我正在将我的应用升级到ruby 2.6.5,似乎是链轮4.0.2导致了这个问题。我找到的大多数答案都是降级到链轮3.7.2(我在本地使用),但是当在Heroku推送过程中编译资产时,我得到了以下错误:

remote:        NoMethodError: undefined method `start_with?' for #<Regexp:0x00005582ab94a790>
remote:        /tmp/build_f56a8b75/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/uri_utils.rb:78:in `valid_asset_uri?'
remote:        /tmp/build_f56a8b75/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/resolve.rb:27:in `resolve'
remote:        /tmp/build_f56a8b75/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:79:in `find_asset'
remote:        /tmp/build_f56a8b75/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:88:in `find_all_linked_assets'
remote:        /tmp/build_f56a8b75/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'

我已将config/initializers/assets.rb修改为:

# Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/
Rails.application.config.assets.precompile << ["*.svg", "*.eot", "*.woff", "*.ttf"]

但是错误仍然发生。有什么办法可以解决这个问题吗?

huus2vyu

huus2vyu1#

我也面临着同样的错误。
我添加了以下版本指定的宝石由于降级链轮和它部署成功。
让菲

gem 'sprockets', '~> 3.0'

相关问题