无法安装rails gem

时间:2011-12-15 21:32:37

标签: ruby-on-rails ruby gem install rvm

不知怎的,我的rails安装成功隐藏了......

我有:

ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
rvm 1.10.0-pre 
gem 1.8.10

我尝试安装rails:

sudo gem install rails

它工作正常:

Successfully installed rails-3.1.3
1 gem installed
Installing ri documentation for rails-3.1.3...
Installing RDoc documentation for rails-3.1.3...

当我这样做时:

rails - v

我得到了

The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails

另外,当我这样做时

rake

在rails app根目录中,我得到:

Missing the Rails  gem. Please `gem install -v= rails`, update your 
RAILS_GEM_VERSION setting in config/environment.rb for the Rails version 
you do have installed, or comment out RAILS_GEM_VERSION to use the 
latest version installed.
执行

gem install -v= rails

引发错误:

ERROR:  While executing gem ... (ArgumentError)
Illformed requirement ["="]

显然,它坐在某个地方,不能被我的环境看到。我想通过apt-get安装不是一个选项,因为我不想混淆宝石......

有什么想法吗? 干杯 MAC

2 个答案:

答案 0 :(得分:7)

请勿使用sudo

只需gem install rails

答案 1 :(得分:1)

使用RVM代替打包的ruby / gems发行版。 http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/