ActionView::Template::Error 无法对值进行 base64 编码

问题描述

每当我想在 Windows 10 上为我的 Rails 6.0 应用程序运行本地开发或测试环境时,独立于我加载的页面,我收到此错误:“无法 Base64 编码值:0 (ActionView::Template::错误)”。这是一个非常奇怪的错误,因为它只出现在我的 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'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...