未初始化的常量HTML::Pipeline::SanitizationFilter::WHITELIST(NameErr



我在这个网站上似乎找不到这个特定的错误来寻求解决方案,希望有人能提供帮助。这是我在运行rails s:时遇到的错误

➜  conquered_self git:(352_space_time_empires) ✗ rails s
Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!
Top level ::Parts is deprecated, require 'multipart/post' and use `Multipart::Post::Parts` instead!
Traceback (most recent call last):
31: from bin/rails:3:in `<main>'
30: from bin/rails:3:in `load'
29: from /Users/buddha/Documents/conquered_self/bin/spring:14:in `<top (required)>'
28: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
27: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
26: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
25: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
24: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
23: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
22: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
21: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
20: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
19: from /Users/buddha/Documents/conquered_self/bin/rails:9:in `<top (required)>'
18: from /Users/buddha/Documents/conquered_self/bin/rails:9:in `require'
17: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands.rb:18:in `<top (required)>'
16: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
15: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:85:in `server'
14: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
13: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:88:in `block in server'
12: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:88:in `require'
11: from /Users/buddha/Documents/conquered_self/config/application.rb:7:in `<top (required)>'
10: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler.rb:174:in `require'
9: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:58:in `require'
8: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:58:in `each'
7: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:69:in `block in require'
6: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:69:in `each'
5: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:74:in `block (2 levels) in require'
4: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:74:in `require'
3: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thredded-0.9.4/lib/thredded.rb:40:in `<top (required)>'
2: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thredded-0.9.4/lib/thredded/content_formatter.rb:2:in `<top (required)>'
1: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thredded-0.9.4/lib/thredded/content_formatter.rb:4:in `<module:Thredded>'
/Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thredded-0.9.4/lib/thredded/content_formatter.rb:8:in `<class:ContentFormatter>': uninitialized constant HTML::Pipeline::SanitizationFilter::WHITELIST (NameError)

这是我的Gemfile:

source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'bitfields', "~> 0.8.0"
gem 'bootstrap', '~> 4.0.0.beta'
gem 'braintree', "~> 2.70.0"
gem 'ckeditor', "~> 4.2.4"
gem 'coffee-rails', '~> 4.2.2'
gem 'devise', "~> 4.6.2"
gem 'devise_masquerade', "~> 0.6.5"
gem 'dragonfly', "~> 1.1.3"
gem 'dragonfly-s3_data_store', "~> 1.3.0"
gem 'exception_notification', "~> 4.2.2"
gem 'execjs', "~> 2.7.0"
gem 'figaro', "~> 1.1.1"
gem 'icalendar', "~> 2.4.1"
gem 'jbuilder', '~> 2.7.0'
gem 'jquery-rails', "~> 4.3.1"
gem 'listen', '~> 3.0.8'
gem 'mandrill_dm'
gem 'meta-tags', "~> 2.6.0"
gem 'mysql2', "~> 0.4.9"
gem 'omniauth-facebook', "~> 5.0.0"
gem 'omniauth-google-oauth2', "~> 0.5.2"
gem 'phony', "~> 2.15.48"
gem 'popper_js', "~> 1.11.1"
gem 'pundit', "~> 1.1.0"
gem 'rails', '~> 5.0.6'
gem 'rails_engine_decorators', git: 'https://github.com/HelloThisIsMartha/rails_engine_decorators'
gem 'react-rails', "~> 2.4.7"
gem 'redis-rails', "~> 5.0.2"
gem 'request_store', "~> 1.3.2"
gem 'rinku', "~> 2.0.3"
gem 'roman-numerals', "~> 0.3.0"
gem 'sass-rails', '~> 5.0.6'
gem 'sidekiq', "~> 5.0.4"
gem 'textris', "~> 0.4.4"
gem 'mini_racer'
gem 'thredded', '~> 0.9.4'
gem "timecop", "~> 0.9.4"
gem 'twilio-ruby', "~> 5.2.3"
gem 'uglifier', '~> 3.2.0'
gem 'websocket-driver', "~> 0.6.5"
gem 'whenever', "~> 0.9.7", :require => false
# Boostrap 4 alpha requires assets tether
source 'https://rails-assets.org' do
gem 'rails-assets-tether', '~> 1.4.0'
end
group :staging, :production, :devasprod do
gem 'puma', '~> 3.12.6'
gem 'puma_worker_killer', "~> 0.1.0"
end
group :staging, :production do
gem 'newrelic_rpm', "~> 4.0.0.332"
end
group :development, :test, :staging do
gem 'byebug', "~> 9.1.0", platform: :mri
gem 'pry-rails', "~> 0.3.6"
gem 'pry-byebug', "~> 3.5.0"
gem 'rspec-rails', '~> 3.6.1'
end
group :development do
gem 'mailcatcher', "~> 0.2.4"
gem 'pry-rescue', "~> 1.4.5"
gem 'pry-stack_explorer', "~> 0.4.9.2"
gem 'rubocop-rails', "~> 2.3.2"
gem 'spring', "~> 2.0.2"
gem 'spring-watcher-listen', '~> 2.0.1'
gem 'web-console', '~> 3.5.1'
end
group :test do
gem 'database_cleaner', "~> 1.6.1"
gem 'factory_girl_rails', "~> 4.8.0"
end
group :development do
gem 'flamegraph', "~> 0.9.5"
gem 'memory_profiler', "~> 0.9.8"
gem 'rack-mini-profiler', "~> 0.10.5"
gem 'stackprof', "~> 0.2.10"
end

Rails和Ruby版本:

➜  conquered_self git:(352_space_time_empires) ✗ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin21]
➜  conquered_self git:(352_space_time_empires) ✗ rails -v
Rails 5.0.7.2

顺便说一句,我尝试了这里提到的建议,并将gem 'faraday-multipart'添加到我的gemfile中,运行bundle,然后rail s给了我一个不同的错误:

➜  conquered_self git:(352_space_time_empires) ✗ rails s
Traceback (most recent call last):
15: from bin/rails:9:in `<main>'
14: from bin/rails:9:in `require'
13: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands.rb:18:in `<top (required)>'
12: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
11: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:85:in `server'
10: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
9: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:88:in `block in server'
8: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:88:in `require'
7: from /Users/buddha/Documents/conquered_self/config/application.rb:7:in `<top (required)>'
6: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler.rb:174:in `require'
5: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:58:in `require'
4: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:58:in `each'
3: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:69:in `block in require'
2: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:69:in `each'
1: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:74:in `block (2 levels) in require'
/Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:74:in `require': cannot load such file -- faraday-multipart (LoadError)
19: from bin/rails:9:in `<main>'
18: from bin/rails:9:in `require'
17: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands.rb:18:in `<top (required)>'
16: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
15: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:85:in `server'
14: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
13: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:88:in `block in server'
12: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:88:in `require'
11: from /Users/buddha/Documents/conquered_self/config/application.rb:7:in `<top (required)>'
10: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler.rb:174:in `require'
9: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:58:in `require'
8: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:58:in `each'
7: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:65:in `block in require'
6: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:88:in `rescue in block in require'
5: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/runtime.rb:88:in `require'
4: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart.rb:6:in `<top (required)>'
3: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart.rb:6:in `require_relative'
2: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:5:in `<top (required)>'
1: from /Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:6:in `<module:Faraday>'
/Users/buddha/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart/middleware.rb:8:in `<module:Multipart>': uninitialized constant Faraday::Request (NameError)

法拉第/法拉第多部分:

如果你以前没有这些宝石,它们就不是问题,你也不需要添加它们。

$ gem uninstall faraday
$ gem uninstall faraday-multipart

此外,从堆栈跟踪的中间可以看出,faraday multipart实际上并没有安装(或者没有正确安装(。尝试gem install faraday-multipart或确保它在您的gemfile中,然后运行bundle install(如果您真的需要(。还要检查Gemfile.lock,看看faradayfaraday-multipart是否存在。

但再次,您似乎根本不需要法拉第或法拉第多部分。你提到的SO谈论的是更新它们,而不是将其添加到没有它们的应用程序中。

威胁:

问题来自这块宝石。具体来说,这个文件的第8行

你可以调试它,也可以严重升级这个过时的gem。(你使用的是0.9.4,目前是0.16.16(

更好的修复:

太多你的宝石看起来真的很旧而且过时了。包括Ruby和Rails。

如果我是你,我会首先将我的Ruby安装更新到3.1.2,然后将我的Rails gem更新到至少6.0+

接下来,我会:

  1. 仔细浏览Gemfile中的每个宝石,并在RubyGems上搜索它,然后逐一升级宝石。

  2. (暴力方法(从Gemfile中删除所有版本要求,使用bundle update一次升级每个gem,看看哪些是修复的,哪些是新损坏的。

相关内容

  • 没有找到相关文章

最新更新