jeudi 1 septembre 2022

ArgumentError: tried to create Proc object without a block

How can I resolve the following error:

$ rails db:migrate
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, 
spell_checker)' instead.
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, 
spell_checker)' instead.
rails aborted!
ArgumentError: tried to create Proc object without a block
D:/Projects/lms-2021/config/application.rb:9:in `<top (required)>'
D:/Projects/lms-2021/Rakefile:4:in `require_relative'
D:/Projects/lms-2021/Rakefile:4:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
(See full trace by running task with --trace)

These are the logs after rails db:migrate --trace:

$ rails db:migrate --trace
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
rails aborted!
ArgumentError: tried to create Proc object without a block
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:472:in `new'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:472:in `service_added'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:510:in `<module:Aws>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:18:in `<top (required)>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `block in require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in `load_dependency'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-resources-2.9.24/lib/aws-sdk-resources.rb:1:in `<top (required)>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `block in require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in `load_dependency'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-2.9.24/lib/aws-sdk.rb:1:in `<top (required)>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:66:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:61:in `each'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:61:in `block in require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:50:in `each'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:50:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler.rb:174:in `require'
D:/Projects/lms-2021/config/application.rb:9:in `<top (required)>'
D:/Projects/lms-2021/Rakefile:4:in `require_relative'
D:/Projects/lms-2021/Rakefile:4:in `<top (required)>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in `load'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in `load_rakefile'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:703:in `raw_load_rakefile'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:104:in `block in load_rakefile'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:103:in `load_rakefile'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/rake/rake_command.rb:18:in `perform'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/command.rb:46:in `invoke'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'

This is the application.rb file where the error is shown:

require 'uri'
require "uri/generic"
require_relative 'boot'

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)


module Ilms
  class Application < Rails::Application    

    config.to_prepare do
      # Load application's model / class decorators
      Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end

      # Load application's view overrides
      Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end
    end
    
    config.assets.initialize_on_precompile = false    
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.1
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

  end
end

I am not understanding where is the error and how to fix it. There seems no error in my code. The logs with --trace are showing the error occured in lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:472:in `new' which callback = Proc.new .

  • Database : postgresql
  • gem 'pg' already installed
  • rails v 5.1.7
  • ruby v 3.1.2
  • windows 10 pro
  • git bash terminal

Aucun commentaire:

Enregistrer un commentaire