

新しく作り直したやつ · Noob-9191/RAILS-dedicated-to-public@0a44837
(<https://github.com/Noob-9191/RAILS-dedicated-to-
public/commit/0a4483789f7de024d5b07770e8f183739b8b1419#diff-0d66e2f983c4dea8c01834cb9c053ceb740299be0f7663b806a524d8419bb9be>)  
ところどころ特定のフォルダやファイルが赤くなってますが、何が問題かわかりません。  
VSCodeで開いても表示が赤くなっていて、どこが問題なのかさっぱりわかりません。

[![なぜか赤くなってるフォルダやファイル](https://i.stack.imgur.com/nAqCr.png)](https://i.stack.imgur.com/nAqCr.png)

VSCodeのWSLで `rails s` もできない状態です。

ChatGPTに頼っても全然解決できません。  
いったい何が問題なのでしょうか？  
どうか解決策をお願いします。

[code]

    $ rails s
    
    => Booting Puma
    => Rails 7.0.7 application starting in development 
    => Run `bin/rails server --help` for more startup options Exiting /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/message_encryptor.rb:209:in
    `rescue in _decrypt': ActiveSupport::MessageEncryptor::InvalidMessage
    (ActiveSupport::MessageEncryptor::InvalidMessage)
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/message_encryptor.rb:186:in
    `_decrypt'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/message_encryptor.rb:160:in
    `decrypt_and_verify'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/messages/rotator.rb:22:in
    `decrypt_and_verify'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_file.rb:104:in
    `decrypt'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_file.rb:66:in
    `read'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_configuration.rb:43:in
    `read'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_configuration.rb:64:in
    `config'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_configuration.rb:79:in
    `options'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/core_ext/module/delegation.rb:303:in
    `method_missing'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.7/lib/active_record/railtie.rb:332:in
    `block in <class:Railtie>'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/initializable.rb:32:in
    `instance_exec'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/initializable.rb:32:in
    `run'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/initializable.rb:61:in
    `block in run_initializers'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:228:in `block
    in tsort_each'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:350:in `block
    (2 levels) in each_strongly_connected_component'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:431:in
    `each_strongly_connected_component_from'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:349:in `block
    in each_strongly_connected_component'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `call'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in
    `each_strongly_connected_component'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:226:in
    `tsort_each'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:205:in
    `tsort_each'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/initializable.rb:60:in
    `run_initializers'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/application.rb:372:in
    `initialize!'
            from /mnt/c/Users/rii/proj/netlibx/config/environment.rb:5:in `<main>'
            from config.ru:3:in `require_relative'
            from config.ru:3:in `block in <main>'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in
    `eval'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in
    `new_from_string'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in
    `load_file'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in
    `parse_file'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/server.rb:349:in
    `build_app_and_options_from_config'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/server.rb:249:in
    `app'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/server.rb:422:in
    `wrapped_app'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:76:in
    `log_to_stdout'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:36:in
    `start'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:143:in
    `block in perform'
            from <internal:kernel>:90:in `tap'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:134:in
    `perform'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in
    `run'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in
    `invoke_command'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:in
    `dispatch'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/command/base.rb:87:in
    `perform'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/command.rb:48:in `invoke'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands.rb:18:in
    `<main>'
            from <internal:/home/sora/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:38:in
    `require'
            from <internal:/home/sora/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:38:in
    `require'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in
    `require'
            from bin/rails:4:in `<main>' <internal:pack>:309:in `unpack1': invalid base64 (ArgumentError)
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/base64.rb:74:in
    `strict_decode64'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/message_encryptor.rb:188:in
    `block in _decrypt'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/message_encryptor.rb:188:in
    `map'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/message_encryptor.rb:188:in
    `_decrypt'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/message_encryptor.rb:160:in
    `decrypt_and_verify'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/messages/rotator.rb:22:in
    `decrypt_and_verify'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_file.rb:104:in
    `decrypt'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_file.rb:66:in
    `read'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_configuration.rb:43:in
    `read'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_configuration.rb:64:in
    `config'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/encrypted_configuration.rb:79:in
    `options'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activesupport-7.0.7/lib/active_support/core_ext/module/delegation.rb:303:in
    `method_missing'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.7/lib/active_record/railtie.rb:332:in
    `block in <class:Railtie>'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/initializable.rb:32:in
    `instance_exec'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/initializable.rb:32:in
    `run'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/initializable.rb:61:in
    `block in run_initializers'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:228:in `block
    in tsort_each'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:350:in `block
    (2 levels) in each_strongly_connected_component'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:431:in
    `each_strongly_connected_component_from'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:349:in `block
    in each_strongly_connected_component'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `call'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:347:in
    `each_strongly_connected_component'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:226:in
    `tsort_each'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/3.1.0/tsort.rb:205:in
    `tsort_each'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/initializable.rb:60:in
    `run_initializers'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/application.rb:372:in
    `initialize!'
            from /mnt/c/Users/rii/proj/netlibx/config/environment.rb:5:in `<main>'
            from config.ru:3:in `require_relative'
            from config.ru:3:in `block in <main>'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in
    `eval'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in
    `new_from_string'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in
    `load_file'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in
    `parse_file'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/server.rb:349:in
    `build_app_and_options_from_config'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/server.rb:249:in
    `app'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/server.rb:422:in
    `wrapped_app'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:76:in
    `log_to_stdout'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:36:in
    `start'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:143:in
    `block in perform'
            from <internal:kernel>:90:in `tap'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands/server/server_command.rb:134:in
    `perform'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in
    `run'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in
    `invoke_command'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:in
    `dispatch'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/command/base.rb:87:in
    `perform'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/command.rb:48:in `invoke'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.7/lib/rails/commands.rb:18:in
    `<main>'
            from <internal:/home/sora/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:38:in
    `require'
            from <internal:/home/sora/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:38:in
    `require'
            from /home/sora/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in
    `require'
            from bin/rails:4:in `<main>'
    
[/code]


CC BY-SA 4.0
2023-09-21T03:26:06.207
96293
2023-09-21T04:24:20.903
2023-09-21T04:12:01.697
3060
59739
question
ruby-on-rails
正しいはずなのに特定のフォルダやファイルが赤くなってるのはなぜ？


Git でソースコードを管理する過程で、「コンフリクト」が発生したままコミットしてしまっているようです。

bin/rails を例に取ると、以下のように `<<< HEAD` ～ `===` ～ `>>> a1cd10` で囲まれた部分があります。

>
[code]

>     <<<<<<< HEAD
>     #!/usr/bin/env ruby
>     =======
>     #!/usr/bin/env ruby.exe
>     >>>>>>> a1cd101aa28f94b85a0f957bf4c5d154344698c3
>     APP_PATH = File.expand_path("../config/application", __dir__)
>     require_relative "../config/boot"
>     require "rails/commands"
>  
[/code]

これは、ローカルと GitHub 上とのコミットで、同じ個所に異なる変更を行ってしまった際にどちらを優先すべきか自動では判別できない時に挿入されます。

コンフリクト (衝突) が発生した際は上記のようなマークを目安に、人間が自分の目で判断して正しいコードに修正したうえで改めてコミットする必要があります。

参考:  
[第4話 コンフリクトは怖くない！解決方法【連載】マンガでわかるGit
～コマンド編～](https://www.r-staffing.co.jp/engineer/entry/20190927_1)


CC BY-SA 4.0
2023-09-21T04:24:20.903
96296
2023-09-21T04:24:20.903
3060
96293
answer