0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

指定のRailsのバージョンをインストールする際のやり方

Last updated at Posted at 2020-01-22

経緯

Railsのバージョンを変更してアプリケーションを作成しようとした際に特定したバージョンをインストールできなかったことが数多くありました。特定したバージョンをインストールするための対策として今回記事を作成しました。

インストールできるバージョン一覧の確認

下記をすることでバージョン一覧の確認ができます。

$ gem list rails

autoprefixer-rails (9.8.4)
chart-js-rails (0.1.7)
coffee-rails (4.2.2)
jquery-rails (4.4.0)
rails (6.0.3.2, 6.0.3.1, 6.0.2.2, 5.2.4.3, 5.2.4.2, 5.2.4)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.3.0)
rails-i18n (5.1.3)
sass-rails (6.0.0, 5.1.0)
sassc-rails (2.1.2)
sprockets-rails (3.2.1)

インストールする方法

間違ったやり方

$ gem install rails

これでは最新のRailsのバージョンがインストールされてしまいます。

正しいやり方

$ gem install -v 数字 rails

とします。

例としてRailsのバージョン6.0.3.1をインストールしたい場合

$ gem install -v 6.0.3.1 rails

これでOKです。

インストールできているかの確認

$ rails -v

Rails 6.0.3.1

これで完了です。

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?