【问题标题】:RAILS Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecatedRAILS 调用 `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)\' 已被弃用
【发布时间】:2022-08-08 07:09:20
【问题描述】:

大家早上好。

我试图理解下面的错误,但由于我是 Rails 新手,所以我不太明白。有没有人知道它可能是什么?

我搜索了互联网,但没有找到任何具体的内容。

我在网上搜索了,但没有发现任何东西,如果有人看过或有链接,你可以发给我,我会看到。

如果您需要更多信息来帮助,请告诉我,我会编辑帖子并添加它,我不知道是否还有其他我可以发布的内容。

谢谢您的帮助 !!


➜ make up  
docker-compose up
Starting XXXXXX_postgres    ... done
Starting XXXXXX_mailcatcher ... done
Starting XXXXXX_rails       ... done
Attaching to XXXXXX_mailcatcher, XXXXXX_postgres, XXXXXX_rails
XXXXXX_mailcatcher    | Starting MailCatcher
XXXXXX_mailcatcher    | ==> smtp://0.0.0.0:1025
XXXXXX_postgres       | 
XXXXXX_postgres       | PostgreSQL Database directory appears to contain a database; Skipping initialization
XXXXXX_postgres       | 
XXXXXX_mailcatcher    | /usr/local/bundle/gems/thin-1.5.1/lib/thin/server.rb:104: warning: constant ::Fixnum is deprecated
XXXXXX_postgres       | 2022-01-21 11:02:46.949 UTC [1] LOG:  starting PostgreSQL 12.8 (Debian 12.8-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
XXXXXX_mailcatcher    | ==> http://0.0.0.0:1080
XXXXXX_postgres       | 2022-01-21 11:02:46.949 UTC [1] LOG:  listening on IPv4 address \"0.0.0.0\", port 5432
XXXXXX_postgres       | 2022-01-21 11:02:46.949 UTC [1] LOG:  listening on IPv6 address \"::\", port 5432
XXXXXX_postgres       | 2022-01-21 11:02:46.954 UTC [1] LOG:  listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"
XXXXXX_postgres       | 2022-01-21 11:02:46.967 UTC [26] LOG:  database system was shut down at 2022-01-21 11:02:42 UTC
XXXXXX_postgres       | 2022-01-21 11:02:46.973 UTC [1] LOG:  database system is ready to accept connections
XXXXXX_rails          | /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/error.rb:105: warning: constant DidYouMean::SPELL_CHECKERS is deprecated
XXXXXX_rails          | Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)\' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)\' instead.
XXXXXX_rails          | Traceback (most recent call last):
XXXXXX_rails          |  52: from bin/rails:2:in `<main>\'
XXXXXX_rails          |  51: from bin/rails:2:in `load\'
XXXXXX_rails          |  50: from /app/bin/spring:7:in `<top (required)>\'
XXXXXX_rails          |  49: from /app/bin/spring:7:in `tap\'
XXXXXX_rails          |  48: from /app/bin/spring:10:in `block in <top (required)>\'
XXXXXX_rails          |  47: from /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require\'
XXXXXX_rails          |  46: from /usr/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require\'
XXXXXX_rails          |  45: from /usr/local/bundle/gems/spring-3.0.0/lib/spring/binstub.rb:11:in `<top (required)>\'
XXXXXX_rails          |  44: from /usr/local/bundle/gems/spring-3.0.0/lib/spring/binstub.rb:11:in `load\'
XXXXXX_rails          |  43: from /usr/local/bundle/gems/spring-3.0.0/bin/spring:49:in `<top (required)>\'
XXXXXX_rails          |  42: from /usr/local/bundle/gems/spring-3.0.0/lib/spring/client.rb:30:in `run\'
XXXXXX_rails          |  41: from /usr/local/bundle/gems/spring-3.0.0/lib/spring/client/command.rb:7:in `call\'
XXXXXX_rails          |  40: from /usr/local/bundle/gems/spring-3.0.0/lib/spring/client/rails.rb:28:in `call\'
XXXXXX_rails          |  39: from /usr/local/bundle/gems/spring-3.0.0/lib/spring/client/rails.rb:28:in `load\'
XXXXXX_rails          |  38: from /app/bin/rails:4:in `<top (required)>\'
XXXXXX_rails          |  37: from /app/bin/rails:4:in `require_relative\'
XXXXXX_rails          |  36: from /app/config/boot.rb:4:in `<top (required)>\'
XXXXXX_rails          |  35: from /app/config/boot.rb:4:in `require\'
XXXXXX_rails          |  34: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/setup.rb:4:in `<top (required)>\'
XXXXXX_rails          |  33: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap.rb:112:in `default_setup\'
XXXXXX_rails          |  32: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap.rb:70:in `setup\'
XXXXXX_rails          |  31: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache.rb:20:in `setup\'
XXXXXX_rails          |  30: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/yaml.rb:50:in `install!\'
XXXXXX_rails          |  29: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/compile_cache/yaml.rb:55:in `init!\'
XXXXXX_rails          |  28: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require\'
XXXXXX_rails          |  27: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi\'
XXXXXX_rails          |  26: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register\'
XXXXXX_rails          |  25: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi\'
XXXXXX_rails          |  24: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require\'
XXXXXX_rails          |  23: from /usr/local/lib/ruby/2.7.0/yaml.rb:4:in `<main>\'
XXXXXX_rails          |  22: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require\'
XXXXXX_rails          |  21: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi\'
XXXXXX_rails          |  20: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register\'
XXXXXX_rails          |  19: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi\'
XXXXXX_rails          |  18: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require\'
XXXXXX_rails          |  17: from /usr/local/lib/ruby/2.7.0/psych.rb:15:in `<main>\'
XXXXXX_rails          |  16: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require\'
XXXXXX_rails          |  15: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi\'
XXXXXX_rails          |  14: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register\'
XXXXXX_rails          |  13: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi\'
XXXXXX_rails          |  12: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require\'
XXXXXX_rails          |  11: from /usr/local/lib/ruby/2.7.0/psych/nodes.rb:2:in `<main>\'
XXXXXX_rails          |  10: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require\'
XXXXXX_rails          |   9: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi\'
XXXXXX_rails          |   8: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register\'
XXXXXX_rails          |   7: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi\'
XXXXXX_rails          |   6: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require\'
XXXXXX_rails          |   5: from /usr/local/lib/ruby/2.7.0/psych/nodes/node.rb:2:in `<main>\'
XXXXXX_rails          |   4: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require\'
XXXXXX_rails          |   3: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi\'
XXXXXX_rails          |   2: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register\'
XXXXXX_rails          |   1: from /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi\'
XXXXXX_rails          | /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require\': superclass mismatch for class StringIO (TypeError)
XXXXXX_rails exited with code 1

这是我的宝石文件

source \'https://rubygems.org\'
git_source(:github) { |repo| \"https://github.com/#{repo}.git\" }

ruby \'2.7.1\'

gem \'rails\', \'~> 6.1.4\'
gem \'pg\', \'~> 1.1\'
gem \'puma\', \'~> 5.0\'
gem \'bcrypt\', \'~> 3.1.7\'
gem \'jwt\'
gem \'simple_command\'
gem \"rqrcode\", \"~> 2.0\"
gem \"pundit\"
gem \'rack-cors\'
gem \'active_model_serializers\', \"~> 0.10.2\"
gem \'kaminari\'
gem \'carrierwave\'
gem \'fog\', require: \'fog/aws\'
gem \"aws-sdk-s3\", require: false
gem \'mini_magick\'
# Reduces boot times through caching; required in config/boot.rb
gem \'bootsnap\', \'>= 1.4.4\', require: false
gem \'paranoia\', \'~> 2.1\'

group :development, :test do
  # Call \'byebug\' anywhere in the code to stop execution and get a debugger console
  gem \'byebug\', platforms: [:mri, :mingw, :x64_mingw]
  gem \'faker\'
  gem \'cpf_faker\'
  gem \"awesome_print\", require:\"ap\"
  gem \'factory_bot_rails\'
  gem \'faker\'
  gem \'rspec-rails\'
end

group :test do
  gem \"database_cleaner-active_record\", \"~> 2.0\"
  gem \"shoulda-matchers\"
  gem \"simplecov\", \"~> 0.21.2\", require: false
end

group :development do
  gem \'faker\'
  gem \'listen\', \'~> 3.3\'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem \'spring\'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem \'tzinfo-data\', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
root@1:/app# bundler -v
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/error.rb:105: warning: constant DidYouMean::SPELL_CHECKERS is deprecated
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)\' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)\' instead.
Bundler version 2.1.4
root@1:/app# gem list | grep bundl
bundle (0.0.1)
bundler (2.3.5, 2.1.4)
root@1:/app# 

    标签: ruby-on-rails ruby rubygems


    【解决方案1】:

    首先,关于DidYouMean 的消息是弃用警告而不是错误,它不会破坏您的应用程序。这意味着DidYouMean::SPELL_CHECKERS 的使用已被弃用,并将在未来的 ruby​​ 版本中删除。在这种情况下,Ruby 3.3。在您使用低于 3.3 的版本之前,您不必担心它。 触发警告的不是您的代码。它来自一个名为 Thor 的 gem。该问题在雷神 1.2.0 版中得到解决。您可以通过调用 bundle update thor 来更新 gem。

    实际错误来自bootsnap gem:

    /usr/local/bundle/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': superclass mismatch for class StringIO (TypeError)
    

    据我所知,它会加载 psych gem 并失败。

    尝试更新它bundle update bootsnap 或删除或检查建议的solutions here

    如果没有帮助,提供bootsnappsychstringio gems 的版本可能会有所帮助

    gem list psych
    gem list stringio
    gem list bootsnap
    

    或您的Gemfile.lock

    【讨论】:

    • 更新雷神工作。 gem list: # gem list psych LOCAL GEMS psych (4.0.3, default: 3.1.0) # gem list stringio LOCAL GEMS stringio (3.0.1, default: 0.1.0) # gem list bootsnap LOCAL GEMS bootsnap (1.10.1 , 1.9.1)
    • 请尝试更新bootsnap
    • 谢谢。有效
    • @DérikBarcellosFavoretti 当答案解决您的问题时,您可以单击答案旁边的复选标记 ✔。这将问题标记为已回答,这使 SO 变得更简洁,并为答案提供了一个小代表凹凸 [+15],这是表达您的感激之情的好方法。
    • 我的上帝。我真的不知道。谢谢!
    【解决方案2】:

    这发生在我将 Rails 项目中的 Ruby 从 3.0.4 更新到 3.1.2 时。

    这为我修复了它:

    bundle update --bundler
    

    希望能帮助到你。

    【讨论】:

      猜你喜欢
      • 2015-02-21
      • 1970-01-01
      • 2022-08-22
      • 2019-04-04
      • 2018-12-12
      • 2014-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多