cloneしたgemfileのバージョンにrailsのバージョンを合わせたい
該当のバージョンをインスール
$ gem install -v 5.2.1 rails
エラーが起きる
gem install -v 5.2.1 rails
ERROR: Error installing rails:
The last version of sprockets (>= 3.0.0) to support your Ruby & RubyGems was 3.7.2. Try installing it with `gem install sprockets -v 3.7.2` and then running the current command again
sprockets requires Ruby version >= 2.5.0. The current ruby version is 2.4.2.198.
rubyのバージョンを変更したので、それに合わせて
gemのアップデート
$ gem update --systems
新しくインストールしたrubyの環境にbundleを入れる
$ gem install bundler
そして先ほどのエラー文を読むと
gem install sprockets -v 3.7.2
してください。となっていたのでこれを実行する。
もう一度
$ gem install -v 5.2.1 rails