LoginSignup
1
0

More than 5 years have passed since last update.

uninitialized constant XXXXXX::Rails::Application (NameError)の対処法

Posted at

問題

新しくcoffeeに関するアプリを作ろうと、

rails new coffee

を実行、その後Gemfileにrspec-railsを追加し

bin/rails g rspec:install

を実行したところ

WARNING: Nokogiri was built against LibXML version 2.9.8, but has dynamically loaded 2.9.4
Traceback (most recent call last):
    24: from bin/rails:4:in `<main>'
    23: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    22: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    21: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
    20: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    19: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    18: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2.1/lib/rails/commands.rb:18:in `<main>'
    17: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2.1/lib/rails/command.rb:46:in `invoke'
    16: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2.1/lib/rails/command/base.rb:65:in `perform'
    15: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    14: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    13: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    12: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2.1/lib/rails/commands/generate/generate_command.rb:21:in `perform'
    11: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2.1/lib/rails/command/actions.rb:17:in `require_application_and_environment!'
    10: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
     9: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
     8: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
     7: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
     6: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
     5: from /Users/reiforu/dev/coffee/config/application.rb:9:in `<main>'
     4: from /Users/reiforu/dev/coffee/config/application.rb:10:in `<module:Coffee>'
     3: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
     2: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:76:in `rescue in load_missing_constant'
     1: from /Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'

/Users/reiforu/dev/coffee/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.1/
lib/bootsnap/load_path_cache/core_ext/active_support.rb:76:in `block in load_missing_constant': 

uninitialized constant Coffee::Rails::Application (NameError)

が発生。

zshを入れたばかりでrbenvが悪いのかとか、
readlineのリンクが張られてないのかとか
いろいろ試したんですが解決に至らず。

結局

問題は、アプリ名をcoffeeとしていたことでした。

rails new coffee_appとし、同じくbundle install等したところ、うまくいきました。


おわり

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0