4
7

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 5 years have passed since last update.

gem uninstall railsでRailsのダウングレードができない

Last updated at Posted at 2017-09-18

起きた問題

Railsをダウングレードしようとして

$ gem uninstall rails -v 5.1.1

したらrailsコマンドが使えなくなりました

$ rails -v
/Users/kenichi/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:2274:in `check_version_conflict': can't activate activesupport-5.1.1, already activated activesupport-5.0.4 (Gem::LoadError)
	from /Users/kenichi/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:1403:in `activate'
	from /Users/kenichi/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:89:in `block in require'
.
.
.

バージョン5.1.1のactivesupportがあるのに5.1.1のrailsがないからコンフリクト起こしてるみたい。

解決法

とりあえずバージョンの確認

$ gem list | grep activesupport
activesupport (5.1.1, 5.0.4, 5.0.3, 5.0.2, 5.0.0.1, 4.2.6, 4.2.5, 4.2.4, 4.2.1, 4.1.6)

$ gem list | grep rails        
autoprefixer-rails (7.1.1.2, 6.7.5)
capistrano-rails (1.2.3)
coffee-rails (4.2.2, 4.2.1, 4.1.1, 4.1.0, 4.0.1)
compass-rails (2.0.0)
dotenv-rails (2.2.1)
factory_girl_rails (4.8.0, 4.4.1)
font-awesome-rails (4.7.0.1)
haml-rails (0.9.0)
jquery-rails (4.3.1, 4.2.2, 4.2.1, 4.0.5, 4.0.3, 3.1.4)
less-rails (2.8.0)
pry-rails (0.3.6, 0.3.5, 0.3.4)
rails (5.0.4, 5.0.3, 5.0.2, 5.0.0.1, 4.2.6, 4.2.5, 4.2.4, 4.2.1, 4.1.6)
rails-controller-testing (1.0.2, 1.0.1)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (2.0.3, 2.0.2, 1.0.8, 1.0.7, 1.0.6)
rails-html-sanitizer (1.0.3, 1.0.2)
rails_12factor (0.0.3)
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
rspec-rails (3.1.0)
sass-rails (5.0.6, 5.0.4, 4.0.5, 4.0.4, 4.0.2)
sprockets-rails (3.2.0, 2.3.3, 2.2.4, 2.0.1)
twitter-bootstrap-rails (3.2.2)

activesupportもアンインストールする。

$ gem uninstall activesupport -v 5.1.1
Successfully uninstalled activesupport-5.1.1

うまくいった。

$ rails -v
Rails 5.0.4

5.1.1のrails gemを入れた時に一緒にactivesupportgemもインストールするみたいですね

調べてみたら、railsリポジトリでissue作られてました。
https://github.com/rails/rails/issues/29113

追記

railtiesをアンインストールすればOK

$ gem uninstall railties -v 5.1.1

4
7
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?