2010-12-06 45 views
1

我目前有rails 3.0.3,并且正在尝试下载和使用版本3.0.1。我已经下载并安装RVM并输入在终端下面的代码(我有一个Mac OS X 10.6.5):当使用RVM切换到较旧的rails版本时出现“File not found:lib”

rvm use 1.8.7 
rvm gemset create rails3.0.1 
rvm [email protected] 
sudo gem install rails --version=3.0.1 

我使用的,因为用户权限的sudo的宝石,或者我缺乏那里。无论如何,我输入的代码的最后一行后:“sudo的创业板安装导轨 - 版本3.0.1 =”我得到以下错误:

Successfully installed rails-3.0.1 
1 gem installed 
Installing ri documentation for rails-3.0.1... 
File not found: lib 

不仅可以我显然没有能够切换轨的版本,尽管它好像我已经安装了多个版本出现,每次我尝试检查,看看有什么版本的Rails,目前我有我得到以下结果:

rails -v 
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError) 
from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate' 
from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem' 
from /usr/bin/rails:18 

而且,我已经安装了Rdoc和Xcode(我已经完成了针对installi的研究和其他建议两者)。我是RoR新手,尤其是RVM新手,所以我很乐意为这种疯狂提供解释和解决方案。

谢谢您的阅读!

回答

1

我觉得你在这里出轨(哈哈):

sudo gem install rails --version=3.0.1 

RVM documentation有这样说的是:

DO NOT use sudo...

to work with RVM gems. When you do sudo you are running commands as root, another user in another shell and hence all of the setup that RVM has done for you is ignored while the command runs under sudo (such things as GEM_HOME, etc...). So to reiterate, as soon as you 'sudo' you are running as the root system user which will clear out your environment as well as any files it creates are not able to be modified by your user and will result in strange things happening. (You will start to think that someone has a voodoo doll of your application...)

+0

有趣!你有没有想过如何以root身份运行命令而不使用sudo?每当我尝试使用gem安装rails的以前版本时,我都会遇到权限错误。 – mmichael 2010-12-06 12:31:27