I am trying to uninstall rails from my computer.Whenever I run the command gem uninstall rails ,it gives me the following error
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check gem list -d rails
Does this cover your question?
Uninstall Rails completely
It is possible that you have multiple versions of Rails installed in your system. Thus, that command might have failed by not deciding which Rails version you intended to remove.
Check your Rails versions by running gem list -d rails or gem list | grep rails and note the versions (Example, I have 3.2.8, 3.2.5, 4.0.0).
To uninstall any version use:
gem uninstall rails -v 3.2.8
Related
It looks like I have installed multiple version of rails :
rails (6.0.0, 5.1.7, 5.1.6.2)
I would like to remove the most recent one, 6.0.0 which I installed in order to use action text, but I realise that it requires me to do quite a few changes.
How can I simply do that please ?
When I do:
$ gem uninstall rails -v 6.0.0
I get :
ERROR: While executing gem ... (Gem::InstallError)
rails is not installed in GEM_HOME, try:
gem uninstall -i /Users/elandron/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0 rails
When i do : / -type d -name rails-6.0.0 , i get
/Users/elandron/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/doc/rails-6.0.0
/Users/elandron/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/rails-6.0.0
/Users/elandron/.rvm/gems/ruby-2.6.3/doc/rails-6.0.0
The following worked for me at the end:
sudo gem uninstall rails -v 4.1.1
Then when running gem list, I only see the version that I wanted.
I attempt to upgrade to Rails 5.1.4. Seems to update without an issue, however, a version check still shows 5.0.4. Any ideas?
Ruby Version:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
Terminal Output:
$ rails -v
Rails 5.0.4
$ gem install rails --version=5.1.4
Successfully installed rails-5.1.4
Parsing documentation for rails-5.1.4
Done installing documentation for rails after 0 seconds
1 gem installed
$ rails -v
Rails 5.0.4
Uninstall all versions of rails installed in your system by:
gem uninstall rails
It should prompt you with something like below
Select gem to uninstall:
1. rails-4.2.6
2. rails-5.1.4
3. All versions
Choose Option "All Versions" and uninstall all
Install the desired rails version:
gem install rails --version=5.1.4
rails -v
5.1.4
Update: Since you mentioned using bundle install, check if rails is specified with 5.1.4 in your Gemfile or not.
Sometimes, i met this problem, because you have two versions of rails in your railties. You can do this
gem uninstall railties
Select gem to uninstall:
1. railties-5.1.4
2. railties-5.0.4
3. All versions
Type 3 to remove all, then you can reinstall rails 5.1.4 again.
Either use
bin/rails -v
or
bundle exec rails -v
to select the version of rails specified in your Gemfile
Or do what I do and install https://direnv.net/ and add a .envrc file to the project. Then when you cd to that project, the path will be updated appropriately and rails -v will work as expected:
PATH_add "./bin"
I currently have a Rails app running on 4.2.5, and I want to use ActionCable without having to upgrade the whole thing to the Rails 5.0.0.beta3 version and risk breaking all of the other gems.
Following guides I've seen on the internet, I've tried
gem 'actioncable', github: 'rails/actioncable'
which doesn't work because the ActionCable repo has been merged into the Rails repo. I even tried
gem 'actioncable', github: 'rails/rails'
but this doesn't seem to work of the re-numbering of the versions that happened when ActionCable merged into Rails. (The only version below 5.0.0.beta* is the 0.0.0, which seems to be an empty gem.)
I also tried setting the source to rubygems.org in hopes of finding an older pre-merged version, but was unsuccessful.
What can I do to integrate ActionCable into my 4.2.5 project without upgrading to Rails 5?
Conversely, when could we anticipate the first stable release of Rails 5? :)
You can have both GemSets, so you can use rails 4 and rails 5 whenever you want.
First, update the ruby gem manager by $ gem update --system, install Nokogiri if you haven't $ gem install nokogiri.
Now lets set your rails 4 GemSet (you might have to update ruby, it will tell you if you need to)
$ rvm use ruby-2.3.0#rails4.2 --create
$ gem install rails --version=4.2.5
$ rails -v
your rails version should be 4.2.5 at this point.
Now lets set your rails 5 GemSet
$ rvm use ruby-2.3.0#rails5.0 --create
$ gem install rails --pre
$ rails -v
your rails version should be 5 beta3 at this point.
We are done, now you only need to change between GemSets, depending on your needs, by doing this.
for rails 4 use = $ rvm use ruby-2.3.0#rails4.2
for rails 5 use = $ rvm use ruby-2.3.0#rails5.0
Now, you can use and experiment rails 5 without risking your rails 4 gems and stuff.
You can do exactly the same for other Rails versions if you want.
I have same issue,But i solved.just check this
Just try your rails console
check your rails version rails -v
may be rails (4.2.7.1)
Then you need to check gem list, i mean gem list -l
Now you can see your all gem with versions.
Then you need to instsll gem install rails -v 5.0.0beta2
once installed rails check gem list, gem list -l
Then you can see rails (5.0.0.rc2, 5.0.0.beta2, 4.2.7.1)
You successfully installed rails 5.0.0
Then you do bundle update
Update all gem and supporting rails 5.0.0,this is work for me just try this.
I am using rails version 4.2.0. How can I downgrade to version 3.2.19?
I tried the following:
I opened command prompt.
I typed gem uninstall rails
Some options came for rails version then I selected my current version and pressed entered.
Then typed gem install rails -v 3.2.19 for installing this version.
I went to my Site directory and typed rails new blog
When I opened the Gemfile of blog application I found again Rails version 4.2.0 is present there.
Do:
gem uninstall rails
gem uninstall railties
Followed by:
gem install rails -v 3.2.19
To check a rails version, directly do:
rails -v
Another workaround:
add following to your Gemfile:
gem 'rails', '3.2.19'
and then run:
bundle install
Or you dont have to downgrade. You can always create a new rails app with a specific version(if that version is already installed)
rails _3.2.19_ new myApp
That is not good approach to uninstall a global version of Rails. So just create a Rails app:
rails new app
then change Rails version in its Gemfile, and issue bundle install:
cd app
sed "s/'rails', '~> 4.2.0'/'rails', '~> 3.2.19'/" -i Gemfile
bundle install
Then, I believe, you should change all the dependent packages to older versions.
Rails command is working . rails -v shows 4.0.0 . gem list rails shows 3.2.13 . I want to work on rails 3.2.13 , when i tried to uninstall rails 4.0.0 it says gem "rails" is not installed .What should i do so that rails -v shows 3.2.13 and rails 4 get uninstalled ?
It's because the Rails binary actually loads itself via the railties gem. The last two lines of /usr/local/bin/rails looks something like:
gem 'railties', version
load Gem.bin_path('railties', 'rails', version)
You need to run:
gem uninstall railties -v 4.0.0
Assuming you have Rails & Railties 3.2.13 installed, rails -v should now return Rails 3.2.13.
I don't know why you want remove rails 4, if you are already using rvm you should easily switch between ruby/rails versions without any problem, if you don't know rvm i recommend you to read why-you-should-use-rvm
if you should remove obligatory rails 4.0.0 try this command :
gem uninstall rails --version 4.0.0
if this can't solve your problem please add more details in your question
It's probably the best way to use rvm https://rvm.io/rvm/install
I had the same problem a week ago.
try gem uninstall rails -v=4.0.0.
or
gem uninstall rails
then install rvm using:
\curl -L https://get.rvm.io | bash
and then
\curl -L https://get.rvm.io | bash -s stable --rails
and
gem install rails --version '~> 3.2.0'