无法切换rails的默认版本ruby

时间:2022-05-24 20:38:36

I'm desperate, please help. I can't figure out how to change Ruby on Rails to run with 2.0.0, even though I think I've done everything to set 2.0.0 as the default, and rvm -list doesn't even show 1.8.7 as an option. I don't know what files I need to move/what pathways I need to change, and my attempts to uninstall rails have been unsuccessful as there's a "missingBundle" error.

我很绝望,请帮忙。我无法弄清楚如何更改Ruby on Rails以使用2.0.0运行,即使我认为我已经完成了将2.0.0设置为默认值的所有内容,并且rvm -list甚至不显示1.8.7一个选项。我不知道我需要移动哪些文件/我需要更改哪些路径,并且我尝试卸载rails是不成功的,因为存在“missingBundle”错误。

$ ruby - v 

returns ruby 2.0.0p247

返回ruby 2.0.0p247

$ rvm--default use 2.0.0 
Using /Users/ericafischer-colbrie/.rvm/gems/ruby-2.0.0-p247

Then,

$ rails -s 
Rails prefers to run ruby 2.0.  You're running ruby 1.8.7 (2012-02-08 patchlevel 358) 
[universal-darwin12.0].  Please upgrade to Ruby 1.9.3 or new to continue.

I've spent a lot of time looking at similar questions posted on * and those solutions so far have not yielded any results.

我花了很多时间查看*上发布的类似问题,到目前为止这些解决方案还没有产生任何结果。

3 个解决方案

#1


2  

Since you're using rvm, make sure you create a gemset and ruby-version file and install the version of rails you want to use.

由于您使用的是rvm,请确保创建gemset和ruby-version文件并安装要使用的rails版本。

E.g inside you're working dir tell rvm which ruby to use, which gemset to use, create both a gemset and ruby-version file:

E.g里面你正在工作dir告诉rvm使用哪个ruby,使用哪个gemset,创建一个gemset和ruby-version文件:

rvm use ruby-2.0.0@my_cool_project --ruby-version --create

Then

gem install rails

To check run which ruby in that directory to make sure it's ruby 2 - - which rails will show you that it's using the gem of rails inside the ruby 2 my cool project gemset. Should be ok

要检查在该目录中运行哪个ruby以确保它是ruby 2 - - 哪个rails将向您显示它正在使用ruby 2中的rails gem我的酷项目gemset。应该可以

#2


1  

Looks like you may have used something like sudo gem install rails.

看起来你可能使用过像sudo gem install rails这样的东西。

When installing gems, you want to be sure to not use the sudo command.

安装gem时,您希望确保不使用sudo命令。

Try sudo gem uninstall rails; rvm use ruby-2.0.0@myapp --create; gem install rails

试试sudo gem uninstall rails; rvm使用ruby-2.0.0@myapp --create;宝石安装导轨

#3


0  

  1. Install rvm in your Macintosh
  2. 在Macintosh中安装rvm

  3. Then do rvm install 2.0.0 or rvm install version(whatever version you need)
  4. 然后做rvm install 2.0.0或rvm安装版(无论你需要什么版本)

  5. Where ever you need a particular version of Ruby(say 2.0.0), do rvm use 2.0.0 and whichever version you need you can switch similarly.
  6. 无论你需要特定版本的Ruby(比如2.0.0),rvm都使用2.0.0,无论你需要哪个版本,都可以进行类似的切换。

If you are not sure how to install rvm or stuck with something else. Please see link for detailed explanation.

如果您不确定如何安装rvm或卡住别的东西。有关详细说明,请参阅链接。


Updated, thanks @Momer.

更新了,谢谢@Momer。

#1


2  

Since you're using rvm, make sure you create a gemset and ruby-version file and install the version of rails you want to use.

由于您使用的是rvm,请确保创建gemset和ruby-version文件并安装要使用的rails版本。

E.g inside you're working dir tell rvm which ruby to use, which gemset to use, create both a gemset and ruby-version file:

E.g里面你正在工作dir告诉rvm使用哪个ruby,使用哪个gemset,创建一个gemset和ruby-version文件:

rvm use ruby-2.0.0@my_cool_project --ruby-version --create

Then

gem install rails

To check run which ruby in that directory to make sure it's ruby 2 - - which rails will show you that it's using the gem of rails inside the ruby 2 my cool project gemset. Should be ok

要检查在该目录中运行哪个ruby以确保它是ruby 2 - - 哪个rails将向您显示它正在使用ruby 2中的rails gem我的酷项目gemset。应该可以

#2


1  

Looks like you may have used something like sudo gem install rails.

看起来你可能使用过像sudo gem install rails这样的东西。

When installing gems, you want to be sure to not use the sudo command.

安装gem时,您希望确保不使用sudo命令。

Try sudo gem uninstall rails; rvm use ruby-2.0.0@myapp --create; gem install rails

试试sudo gem uninstall rails; rvm使用ruby-2.0.0@myapp --create;宝石安装导轨

#3


0  

  1. Install rvm in your Macintosh
  2. 在Macintosh中安装rvm

  3. Then do rvm install 2.0.0 or rvm install version(whatever version you need)
  4. 然后做rvm install 2.0.0或rvm安装版(无论你需要什么版本)

  5. Where ever you need a particular version of Ruby(say 2.0.0), do rvm use 2.0.0 and whichever version you need you can switch similarly.
  6. 无论你需要特定版本的Ruby(比如2.0.0),rvm都使用2.0.0,无论你需要哪个版本,都可以进行类似的切换。

If you are not sure how to install rvm or stuck with something else. Please see link for detailed explanation.

如果您不确定如何安装rvm或卡住别的东西。有关详细说明,请参阅链接。


Updated, thanks @Momer.

更新了,谢谢@Momer。