mywork1868
@mywork1868

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

rails newでエラーが出てデータベースが作成できません

Q&A

Closed

解決したいこと

rails newでのエラーを解消したいです。

発生している問題・エラー

rails _6.0.0_ new matching_app -d mysql
      create
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in /home/maiko/projects/matching_app/.git/
      create  package.json
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/javascript/channels/consumer.js
      create  app/javascript/channels/index.js
      create  app/javascript/packs/application.js
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/yarn
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/spring.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults_6_0.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      append  .gitignore
/home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-6.0.0/lib/active_support/messages/metadata.rb:17:in `wrap': wrong number of arguments (given 2, expected 1) (ArgumentError)
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-6.0.0/lib/active_support/message_encryptor.rb:175:in `_encrypt'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-6.0.0/lib/active_support/message_encryptor.rb:151:in `encrypt_and_sign'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-6.0.0/lib/active_support/encrypted_file.rb:76:in `encrypt'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-6.0.0/lib/active_support/encrypted_file.rb:50:in `write'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/activesupport-6.0.0/lib/active_support/encrypted_configuration.rb:29:in `write'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/lib/rails/generators/rails/credentials/credentials_generator.rb:30:in `add_credentials_file_silently'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/lib/rails/generators/rails/app/app_generator.rb:177:in `credentials'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/lib/rails/generators/app_base.rb:156:in `build'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/lib/rails/generators/rails/app/app_generator.rb:331:in `create_credentials'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:134:in `block in invoke_all'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:134:in `each'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:134:in `map'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:134:in `invoke_all'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/group.rb:232:in `dispatch'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/lib/rails/commands/application/application_command.rb:26:in `perform'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/lib/rails/cli.rb:18:in `<top (required)>'
        from <internal:/home/maiko/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/home/maiko/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /home/maiko/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-6.0.0/exe/rails:10:in `<top (required)>'
        from /home/maiko/.rbenv/versions/3.2.0/bin/rails:25:in `load'
        from /home/maiko/.rbenv/versions/3.2.0/bin/rails:25:in `<main>'

自分で試したこと

引数のエラーが出ているらしいことはわかったのですが、なぜそれが起こっているかまではわかりませんでした。

0

1Answer

RailsとRubyの対応バージョンを確認のうえ環境構築しましたか?

また、Rails6.0.0は既にEOL(サポート終了)ですので、
もし今学習されるのであれば最低でも6.1以上が良いかと思います。
(ただ、それでもRuby3.2.0には対応していませんが)

1Like

Comments

  1. @mywork1868

    Questioner

    ご回答ありがとうございます。
    プログラミングスクールのカリキュラムばかり見ており、対応バージョンを確認しておりませんでした。
    確認の上、再度環境構築してみます。

Your answer might help someone💌