rubyにおけるdevise導入時のエラー

実現したいこと

ruby on rails を使ってログイン、ログアウト機能を作ろうとしています。

前提

Railsでログイン、ログアウト機能を作っています。
deviseで利用するユーザー情報に関するファイルを実装中に以下のエラーメッセージが発生しました。

発生している問題・エラーメッセージ

C:/Users/81802/myWebApp/pdiary/config/initializers/devise.rb:11:in `<main>': uninitialized constant Devise (NameError) Devise.setup do |config| ^^^^^^ from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/engine.rb:667:in `load' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/engine.rb:667:in `block in load_config_initializer' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/notifications.rb:208:in `instrument' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/engine.rb:666:in `load_config_initializer' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/engine.rb:619:in `each' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/engine.rb:619:in `block in <class:Engine>' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `instance_exec' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `run' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/initializable.rb:61:in `block in run_initializers' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:421:in `block in each_strongly_connected_component_from' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `each' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `tsort_each_child' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:415:in `call' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:415:in `each_strongly_connected_component_from' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `call' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each' from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/initializable.rb:60:in `run_initializers' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/application.rb:372:in `initialize!' from C:/Users/81802/myWebApp/pdiary/config/environment.rb:5:in `<main>' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/application.rb:348:in `require_environment!' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/command/actions.rb:28:in `require_environment!' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/command/actions.rb:15:in `require_application_and_environment!' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands/generate/generate_command.rb:21:in `perform' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/command/base.rb:87:in `perform' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/command.rb:48:in `invoke' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<main>' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require' from bin/rails:4:in `<main>'

該当のソースコード

ruby

1ruby bin/rails generate devise User

試したこと

ここに問題に対して試したことを記載してください。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

コメントを投稿

0 コメント