`find_spec_for_exe': can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)が発生した時

##1.エラーの発生

久々に自宅のPCでrailsプロジェクトを作成しようとした際に、下記のエラーに遭遇した。
だいぶ前にクリーンインストール等

```
find_spec_for_exe': can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)
```


`rails new`も`rails -v`も全て同じエラーが出てしまい、rails関係のコマンドが一切使えない。

##2.試したこと
①bundlerのバージョンの問題と想定

```
$ rbenv exec gem install bundler
$ rbenv rehash
```
こちらを試してみたが、同じエラーの発生。


②rbenvの使用しているバージョンを変更し、再度`gem install bundler`

```
$ rbenv versions
  system
* 2.6.5 (set by /Users/○○○○○/.rbenv/version)
  2.7.0

$ rbenv global 2.7.0

$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]

$ gem install bundler
For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0

Successfully installed i18n-1.8.5
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.7
Successfully installed zeitwerk-2.4.0
Successfully installed activesupport-6.0.3.2
Successfully installed rack-2.2.3
Successfully installed rack-test-1.1.0
Successfully installed mini_portile2-2.4.0
Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.10
Successfully installed crass-1.0.6
Successfully installed loofah-2.7.0
Successfully installed rails-html-sanitizer-1.3.0
Successfully installed rails-dom-testing-2.0.3
Successfully installed builder-3.2.4
Successfully installed erubi-1.9.0
Successfully installed actionview-6.0.3.2
Successfully installed actionpack-6.0.3.2
Successfully installed activemodel-6.0.3.2
Successfully installed activerecord-6.0.3.2
Successfully installed globalid-0.4.2
Successfully installed activejob-6.0.3.2
Successfully installed mini_mime-1.0.2
Successfully installed mail-2.7.1
Successfully installed actionmailer-6.0.3.2
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.2
Successfully installed websocket-extensions-0.1.5
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.3
Successfully installed actioncable-6.0.3.2
Successfully installed mimemagic-0.3.5
Successfully installed marcel-0.3.3
Successfully installed activestorage-6.0.3.2
Successfully installed actionmailbox-6.0.3.2
Successfully installed actiontext-6.0.3.2
Successfully installed thor-1.0.1
Successfully installed method_source-1.0.0
Successfully installed railties-6.0.3.2
Successfully installed sprockets-4.0.2
Successfully installed sprockets-rails-3.2.1
Successfully installed rails-6.0.3.2
Parsing documentation for concurrent-ruby-1.1.7
Installing ri documentation for concurrent-ruby-1.1.7
Parsing documentation for i18n-1.8.5
Installing ri documentation for i18n-1.8.5
Parsing documentation for thread_safe-0.3.6
Installing ri documentation for thread_safe-0.3.6
Parsing documentation for tzinfo-1.2.7
Installing ri documentation for tzinfo-1.2.7
Parsing documentation for zeitwerk-2.4.0
Installing ri documentation for zeitwerk-2.4.0
Parsing documentation for activesupport-6.0.3.2
Installing ri documentation for activesupport-6.0.3.2
Parsing documentation for rack-2.2.3
Installing ri documentation for rack-2.2.3
Parsing documentation for rack-test-1.1.0
Installing ri documentation for rack-test-1.1.0
Parsing documentation for mini_portile2-2.4.0
Installing ri documentation for mini_portile2-2.4.0
Parsing documentation for nokogiri-1.10.10
Installing ri documentation for nokogiri-1.10.10
Parsing documentation for crass-1.0.6
Installing ri documentation for crass-1.0.6
Parsing documentation for loofah-2.7.0
Installing ri documentation for loofah-2.7.0
Parsing documentation for rails-html-sanitizer-1.3.0
Installing ri documentation for rails-html-sanitizer-1.3.0
Parsing documentation for rails-dom-testing-2.0.3
Installing ri documentation for rails-dom-testing-2.0.3
Parsing documentation for builder-3.2.4
Installing ri documentation for builder-3.2.4
Parsing documentation for erubi-1.9.0
Installing ri documentation for erubi-1.9.0
Parsing documentation for actionview-6.0.3.2
Installing ri documentation for actionview-6.0.3.2
Parsing documentation for actionpack-6.0.3.2
Installing ri documentation for actionpack-6.0.3.2
Parsing documentation for activemodel-6.0.3.2
Installing ri documentation for activemodel-6.0.3.2
Parsing documentation for activerecord-6.0.3.2
Installing ri documentation for activerecord-6.0.3.2
Parsing documentation for globalid-0.4.2
Installing ri documentation for globalid-0.4.2
Parsing documentation for activejob-6.0.3.2
Installing ri documentation for activejob-6.0.3.2
Parsing documentation for mini_mime-1.0.2
Installing ri documentation for mini_mime-1.0.2
Parsing documentation for mail-2.7.1
Installing ri documentation for mail-2.7.1
Parsing documentation for actionmailer-6.0.3.2
Installing ri documentation for actionmailer-6.0.3.2
Parsing documentation for nio4r-2.5.2
Installing ri documentation for nio4r-2.5.2
Parsing documentation for websocket-extensions-0.1.5
Installing ri documentation for websocket-extensions-0.1.5
Parsing documentation for websocket-driver-0.7.3
Installing ri documentation for websocket-driver-0.7.3
Parsing documentation for actioncable-6.0.3.2
Installing ri documentation for actioncable-6.0.3.2
Parsing documentation for mimemagic-0.3.5
Installing ri documentation for mimemagic-0.3.5
Parsing documentation for marcel-0.3.3
Installing ri documentation for marcel-0.3.3
Parsing documentation for activestorage-6.0.3.2
Installing ri documentation for activestorage-6.0.3.2
Parsing documentation for actionmailbox-6.0.3.2
Installing ri documentation for actionmailbox-6.0.3.2
Parsing documentation for actiontext-6.0.3.2
Installing ri documentation for actiontext-6.0.3.2
Parsing documentation for thor-1.0.1
Installing ri documentation for thor-1.0.1
Parsing documentation for method_source-1.0.0
Installing ri documentation for method_source-1.0.0
Parsing documentation for railties-6.0.3.2
Installing ri documentation for railties-6.0.3.2
Parsing documentation for sprockets-4.0.2
Installing ri documentation for sprockets-4.0.2
Parsing documentation for sprockets-rails-3.2.1
Installing ri documentation for sprockets-rails-3.2.1
Parsing documentation for rails-6.0.3.2
Installing ri documentation for rails-6.0.3.2
Done installing documentation for concurrent-ruby, i18n, thread_safe, tzinfo, zeitwerk, activesupport, rack, rack-test, mini_portile2, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, builder, erubi, actionview, actionpack, activemodel, activerecord, globalid, activejob, mini_mime, mail, actionmailer, nio4r, websocket-extensions, websocket-driver, actioncable, mimemagic, marcel, activestorage, actionmailbox, actiontext, thor, method_source, railties, sprockets, sprockets-rails, rails after 36 seconds
40 gems installed
```

何が原因だったか覚えていないのですが、railsに必要なgemが入っていなかったらしい。。。

```
$ rails -v
Rails 6.0.3.2
```
無事にrailsが入った模様。

ちなみにこちらのエラーは、`rails db:migrate`で発生する場合や、`rails s`で発生する場合があるみたいなのですが、
その場合は、作成したプロジェクトのGemfile.lockがローカルのバージョンと違うみたいな場合があるみたいなので、注意が必要です。