0
test@test-VirtualBox:~$ sudo gem uninstall rails
[sudo] password for test: 
Successfully uninstalled rails-4.0.0
test@test-VirtualBox:~$ rails -v
Rails 4.0.0

test@test-VirtualBox:~$ sudo gem install rails -v 3.2.11
[sudo] password for test: 
Successfully installed rails-3.2.11
test@test-VirtualBox:/home$ rails -v
Rails 4.0.0

test@test-VirtualBox:~$ sudo gem uninstall rails -v 4.0.0
INFO:  gem "rails" is not installed

test@test-VirtualBox:~$ sudo gem uninstall rails -v 3.2.11    
You have requested to uninstall the gem:
rails-3.2.11
gmaps4rails-1.5.6 depends on [rails (~> 3.2.1)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  

为什么?

对于它的价值,以下是补充信息。

test@test-VirtualBox:~$ gem list rails
*** LOCAL GEMS ***
rails (4.0.0)
test@test-VirtualBox:~$ 
test@test-VirtualBox:~$ sudo rails -v
Rails 4.0.0
test@test-VirtualBox:~$ rails -v
Rails 4.0.0

宝石文件

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
4

2 回答 2

1

尝试使用这个:

gem install rails # No sudo

我认识的大多数人都在使用 rvm(或 rbenv):https ://rvm.io/

于 2013-07-19T17:53:06.457 回答
0

我无法解释整个机制,但我发现我的 rails.rb 是

#!/usr/bin/ruby1.9.1
#
# This file was generated by RubyGems.
#
# The application 'railties' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'railties', version
load Gem.bin_path('railties', 'rails', version)

var/lib/gems/1.9.1/gems/railties-4.0.0/lib/rails/version.rb

module Rails
  module VERSION
    MAJOR = 4
    MINOR = 0
    TINY  = 0
    PRE   = nil

    STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
 end
end

这些应该与这个烂摊子有关,所以我试图删除railties。

test@test-VirtualBox:~$ sudo gem uninstall railties
[sudo] password for test: 
Select gem to uninstall:
 1. railties-3.2.11
 2. railties-4.0.0
 3. All versions
> 2
You have requested to uninstall the gem:
    railties-4.0.0
coffee-rails-4.0.0 depends on [railties (< 5.0, >= 4.0.0.beta)]
jquery-rails-3.0.4 depends on [railties (< 5.0, >= 3.0)]
sass-rails-4.0.0 depends on [railties (< 5.0, >= 4.0.0.beta)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled railties-4.0.0
test@test-VirtualBox:~$ rails -v
Rails 3.2.11
于 2013-07-19T17:15:41.090 回答