2010-12-06 44 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