'Rails 5.2 + webpack - NoMethodError when trying rake assets:precompile
I've been working on a project, I started a re-design of it, and continued developing it on the main branch. I've just gone to rebase & pull the changes from master into the redesign branch, and it's no longer updating the CSS on the changes I've made.
I've tried to clear caches etc. and I then thought I'd try precompiling assets locally to see if that fixed it and I'm getting the below error.
Can anyone shed some light on how I could fix this please? I'm not very familiar with the asset pipeline and I've got stuck.
** Execute assets:precompile
rails aborted!
NoMethodError: undefined method `start_with?' for /\.(?:svg|eot|woff|ttf)$/:Regexp
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/sprockets-4.0.3/lib/sprockets/uri_utils.rb:78:in `valid_asset_uri?'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/sprockets-4.0.3/lib/sprockets/resolve.rb:27:in `resolve'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/sprockets-4.0.3/lib/sprockets/base.rb:79:in `find_asset'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/sprockets-4.0.3/lib/sprockets/base.rb:88:in `find_all_linked_assets'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `each'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `to_a'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `block in synchronize'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `synchronize'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `synchronize'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:22:in `execute'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/promise.rb:564:in `block in realize'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `run_task'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:343:in `block (3 levels) in create_worker'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `loop'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block (2 levels) in create_worker'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `catch'
/Users/username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `block in create_worker'
Tasks: TOP => assets:precompile
Development.rb:
# frozen_string_literal: true
Rails.application.configure do
config.after_initialize do
# Bullet.enable = true
# Bullet.sentry = true
# Bullet.alert = true
# Bullet.bullet_logger = true
Bullet.console = true
Bullet.rails_logger = true
# Bullet.honeybadger = true
Bullet.add_footer = true
# Bullet.skip_html_injection = false
# Bullet.slack = { webhook_url: 'https://hooks.slack.com/services/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', channel: '#default', username: 'Bullet-notifier' }
end
# Must include to get inline SVGs to work in deploy
config.assets.css_compressor = :scss
# notifier = Slack::Notifier.new "https://hooks.slack.com/services/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" do
# defaults channel: "#bullet",
# username: "notifier"
# end
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_cable.url = 'ws://localhost:3000/cable'
config.eager_load = false
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send.
config.action_mailer.perform_caching = false
config.active_support.deprecation = :log
config.active_record.migration_error = :false
config.assets.debug = false
# config.assets.quiet = true
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.active_record.dump_schema_after_migration = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.default charset: 'utf-8'
config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
# Suppress logger output for asset requests.
# config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
