質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

4485閲覧

rails バージョン変更できない 5.2.1→5.1.3

退会済みユーザー

退会済みユーザー

総合スコア0

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2018/08/15 03:28

以下の記事を参考に実行してみましたが、バージョンダウンができません。
何が間違っているかご指摘いただければ幸いです。

https://qiita.com/tosato3/items/61b8c4a5f509f44c762b
https://qiita.com/Hassan/items/eef26c870eb26a0c68e0

vagrant@localhost myblog]$ rails --version
Rails 5.2.1
[vagrant@localhost myblog]$ gem uninstall rails

Select gem to uninstall:

  1. rails-5.1.3
  2. rails-5.1.6
  3. rails-5.2.1
  4. All versions

4

Successfully uninstalled rails-5.1.3
Successfully uninstalled rails-5.1.6
Successfully uninstalled rails-5.2.1
[vagrant@localhost myblog]$ rails -v
Could not find rails-5.2.1 in any of the sources
Run bundle install to install missing gems.
[vagrant@localhost myblog]$ gem install rails -v '5.1.3' --no-rdoc --no-ri
Fetching: rails-5.1.3.gem (100%)
Successfully installed rails-5.1.3
1 gem installed
[vagrant@localhost myblog]$ rails -v
Could not find rails-5.2.1 in any of the sources
Run bundle install to install missing gems.
[vagrant@localhost myblog]$ gem uninstall railties -v '5.2.1'
Successfully uninstalled railties-5.2.1
[vagrant@localhost myblog]$ rails -v
Could not find railties-5.2.1 in any of the sources
Run bundle install to install missing gems.
[vagrant@localhost myblog]$ gem uninstall activesupport -v 5.2.1

You have requested to uninstall the gem:
activesupport-5.2.1

actionpack-5.2.1 depends on activesupport (= 5.2.1)
actionview-5.2.1 depends on activesupport (= 5.2.1)
activejob-5.2.1 depends on activesupport (= 5.2.1)
activemodel-5.2.1 depends on activesupport (= 5.2.1)
activerecord-5.2.1 depends on activesupport (= 5.2.1)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN] y
Successfully uninstalled activesupport-5.2.1
[vagrant@localhost myblog]$ rails -v
Could not find activesupport-5.2.1 in any of the sources
Run bundle install to install missing gems.
[vagrant@localhost myblog]$ rails -l
Could not find activesupport-5.2.1 in any of the sources
Run bundle install to install missing gems.
[vagrant@localhost myblog]$ gem list rails

*** LOCAL GEMS ***

coffee-rails (4.2.2)
rails (5.1.3)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.4)
sass-rails (5.0.7)
sprockets-rails (3.2.1)
[vagrant@localhost myblog]$ gem install rails -v "5.1.3"
Successfully installed rails-5.1.3
Parsing documentation for rails-5.1.3
Installing ri documentation for rails-5.1.3
Done installing documentation for rails after 0 seconds
1 gem installed
[vagrant@localhost myblog]$ rails -v
Could not find activesupport-5.2.1 in any of the sources
Run bundle install to install missing gems.
[vagrant@localhost myblog]$ gem i -v 5.1.3 rails
ERROR: While executing gem ... (Gem::Requirement::BadRequirementError)
Illformed requirement ["5.1.3"]
[vagrant@localhost myblog]$ gem i -v 5.1.3 rails
Successfully installed rails-5.1.3
Parsing documentation for rails-5.1.3
Done installing documentation for rails after 0 seconds
1 gem installed
[vagrant@localhost myblog]$rails -v
Could not find activesupport-5.2.1 in any of the sources
Run bundle install to install missing gems.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

qiitaの両記事はrailsコマンドのバージョンを指定してインストールする方法が書かれていますが、今回の場合ではmyblogというプロジェクトのディレクトリ内で実行しているため、そのディレクトリ(にあるGemfile)で指定してされるgemのバージョンとの不整合が生じてしまい、このようなエラーが出ているのかと思います。

試しに、ターミナルから、

cd .. rails -v

と実行してみると、rails 5.1.3の方が表示されるかと思います(railsを全部アンインストールしてrails 5.1.3だけインストールされた状態なら)。

投稿2018/08/16 17:07

takahashim

総合スコア1877

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2018/08/16 23:39

ご指示通りに実行してみたらされてました!!有難う御座います!!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問