安装
Ruby和
Ruby Gems之后:
$sudo apt-get install ruby rubygems ... $ruby -v ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux] $gem -v 1.3.7
如果我尝试安装Rails,我得到一个错误,即使它似乎只是文档,rails没有安装:
$sudo gem install rails ... Successfully installed rails-3.0.1 24 gems installed ... Installing ri documentation for builder-2.1.2... ERROR: While generating documentation for builder-2.1.2 ... MESSAGE: Unhandled special: Special: type=17,text="<!-- HI -->" ... RDOC args: --ri --op /var/lib/gems/1.8/doc/builder-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers --quiet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation (continuing with the rest of the installation) ... Installing ri documentation for rails-3.0.1... File not found: lib $rails -v The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails
Ubuntu存储库只有Rails 2.3.5,所以不是一个选项.
如何让Rails正确安装?
更新:我试过以下,这次没有错,但还是没有成功:
$sudo gem install rails --no-rdoc --no-ri Successfully installed rails-3.0.1 1 gem installed $rails -v The program 'rails' is currently not installed...
更新2:所以,感谢Maran和Jörg,现在我知道问题不在于没有安装rails,但是没有添加到PATH中.这可以通过在〜/ .bashrc中添加以下内容来修复:
export PATH=/var/lib/gems/1.8/bin:$PATH
这又提出了一个问题:PATH应该添加什么?大概apt-get安装rubygems?还有什么可以打破?
解决方法
我强烈建议您跳过Ubuntu软件包并使用
RVM.安装过程非常简单,documented.还有一个
Railscast.
RVM将允许您安装多个版本并创建自定义gemsets(无依赖性问题).它是值得的,很快成为使用Ruby开发(和部署)的事实上的方式.