且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

与 RVM 一起安装时找不到 Rails 命令行

更新时间:2023-09-27 16:05:10

要查看您已安装的 rubies:

To see the rubies you have installed:

rvm list rubies

你会看到这样的:

   ree-1.8.7-2011.03 [ i686 ]
*  ruby-1.9.2-p290 [ x86_64 ]
   ruby-1.9.3-p0 [ x86_64  ] 
=> ruby-1.9.3-p125 [ x86_64 ]
   ruby-1.9.3-p125-perf [ x86_64 ]

要使用特定的:

rvm use ruby-1.9.3-p125

然后如果你执行 ruby --version,你会看到:

then if you do ruby --version, you'll see:

ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.7.0]

每个这些红宝石中,您需要安装所有要使用的宝石.我这样做的方法实际上是使用 Bundler 为项目安装所有 gem.但是对于这里的简单情况,只需执行以下操作:

In each of these rubies you need to install all the gems you want to use. The way I do it is actually by using Bundler to install all the gems for a project. But for the simple case here, just do:

rvm all do gem install rails

这将在 所有 ruby​​ 版本中安装 rails gem.要安装到特定的,请使用:

This will install the rails gem in all your ruby versions. To install to a particular one, use:

rvm ruby-1.9.3-p125  do gem install rails