每当我想在 Windows 10 上为我的 Rails 6.0 应用程序运行本地开发或测试环境时,与我加载的页面无关,我都会收到此错误:“Cannot Base64 encode value: 0 (ActionView::Template::Error)” . 这是一个非常奇怪的错误,它只出现在我的 Windows 10 机器上,而不出现在 Ubuntu 上,而不出现在 Windows 7 上,尽管使用了完全相同的文件(并且可能是相同的 gem 版本;Gemfile.lock 是相同的)。
避免该错误的唯一方法是注释掉所有 stylesheet_link_tag 和 javascript_include_tag。但是,如果我尝试包含来自在线资源的 CSS 或 JS 文件,但没有这些标签,则会出现相同的错误。
从 puma 切换到 webrick 没有任何效果。我还尝试让开发环境在全新的 Windows 10 机器上运行;同样的结果。Windows 10 和 Ruby on Rails 之间是否存在任何已知的不兼容性?
痕迹:
Puma caught this error: Error: Cannot Base64 encode value: 0 (ActionView::Template::Error)
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:78:in `compile'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/coffee_script_processor.rb:24:in `block in call'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/cache.rb:92:in `fetch'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/coffee_script_processor.rb:23:in `call'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:22:in `block in <class:CompositeProcessor>'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:33:in `call'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/bundle.rb:27:in `call'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:81:in `find_asset'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:88:in `find_all_linked_assets'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `block in synchronize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:19:in `execute'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/promise.rb:563:in `block in realize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:363:in `run_task'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `block (3 levels) in create_worker'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `loop'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `block (2 levels) in create_worker'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `catch'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block in create_worker'