1

我在没有 RVM 的情况下使用Rails 3.2.14Ruby ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

除了我当前的 Rails 版本之外,我还需要在同一台机器上使用 Rails 2.3。我已经搜索了允许我在同一台机器上同时使用它们的东西,我找到了它的 RVM。

我正在使用Oh-My-ZSH并且我输入了这个命令来安装 RVM

\curl -L https://get.rvm.io | bash -s stable

安装后我收到此警告

  * WARNING: You have '~/.profile' file, you might want to load it,
    to do that add the following line to '/home/dexter/.bash_profile':

      source ~/.profile

而且我不知道我应该如何处理我目前的 ruby​​ 和 rails。 使用 Rails 3 和 Rails 所需的步骤是什么,前面的警告是什么,下面的警告是什么

➜  ~  ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
➜  ~  which ruby
ruby: aliased to bundled_ruby

当我输入 rvm 列表时:

rvm list

rvm rubies


# No rvm rubies installed yet. Try 'rvm help install'.

当我尝试去我的名为 Triton 的项目时

➜  ~  cd ~/Desktop\ item/Triton
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /home/dexter/Desktop item/Triton/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

ruby-1.9.3-p448 is not installed.
To install do: 'rvm install ruby-1.9.3-p448'
4

3 回答 3

3

使用 rvm 安装您需要的任何版本的 ruby​​。例如

$ rvm install 1.8.7
$ rvm use 1.8.7
$ gem install rails -v 2.3

使用 gemset 返回到您的系统版本的 ruby

$ rvm use system
$ ruby -v
(Should be) ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

要切换到 1.8.7(例如),请使用

$ rvm use 1.8.7

您也可以将 rvm 用于两个版本的 rails 和一个 ruby​​ 版本 - 尝试 gemsets

$ rvm install 1.9.3-p194
$ rvm use 1.9.3-p194
$ rvm gemset create rails2
$ rvm gemset use rails2
$ gem install rails 2.3
$ rvm gemset create rails3
$ rvm gemset use rails3
$ rvm install rails -v 3.2.14

有关 gemsets 的完整信息,请查看http://rvm.io/gemsets

于 2013-08-15T19:30:28.917 回答
1

我收到了这个警告并继续我的安装没有问题...你能输入“rvm list”吗,它是否将 rvm 识别为命令?您是否在安装导轨时遇到问题?

于 2013-08-15T19:12:51.187 回答
1

你得到no rvm rubies installed yet是因为 rvm 范围内没有红宝石。您的“主要”系统 ruby​​ 与使用 rvm 安装的 ruby​​ 没有任何共同之处,这是故意的。你应该在 rvm 中安装 ruby​​:

rvm install ruby-1.9.3-p194

如果你想要特定的路径级别。

你可以使用它

rvm use ruby-1.9.3-p194

如果你想要特定的路径级别。你应该创建新的gemset

rvm gemset create PutNameHere

然后使用它(如果我没记错的话应该自动完成)

rvm gemset use PutNameHere

从那时起,您应该以常规方式安装 gem,它们应该进入具有特定 ruby​​ 版本的特定 gemset。

编辑:如果你想安装ruby 1.8.6rails 2应该:

rvm install ruby-1.8.6 # this may take a while
rvm use ruby-1.8.6
rvm create gemset Triton # or any other name you like
rvm gemset use Triton
gem install rails -v '~> 2.3' # or an other version you want, but much better will be to do:
bundle install #of course in your app root directory - it will install all necessary gems     altogeter with rails 2 or whatever you have specified
于 2013-08-15T19:23:07.667 回答