简体   繁体   English

在终端上安装Ruby和RVM时出现错误

[英]I'm getting an error when installing Ruby and RVM on the terminal

How do I uninstall the old ruby versions and how do can I update to GemFile to 2.4.2? 如何卸载旧的ruby版本,如何将GemFile更新到2.4.2?

Sandys-MacBook-Pro:roughhouse-web sandychow$ bundle install Your Ruby version is 2.4.2, but your Gemfile specified 2.2.5 Sandys-MacBook-Pro:roughhouse-web sandychow$ rvm list Sandys-MacBook-Pro:roughhouse-web sandychow $捆绑安装Ruby版本为2.4.2,但您的Gemfile指定2.2.5 Sandys-MacBook-Pro:roughhouse-web sandychow $ rvm列表

rvm rubies rvm红宝石

ruby-2.1.5 [ missing bin/ruby ] ruby-2.2.5 [ missing bin/ruby ] * ruby-2.4.1 [ x86_64 ] => ruby-2.4.2 [ x86_64 ] ruby-2.1.5 [丢失的bin /红宝石] ruby​​-2.2.5 [丢失的bin /红宝石] * ruby​​-2.4.1 [x86_64] => ruby​​-2.4.2 [x86_64]

To specify a Ruby version in your Gemfile, simply include the version towards the top: 要在Gemfile中指定Ruby版本,只需在顶部添加版本:

For Ruby 2.4.2, you can do this: 对于Ruby 2.4.2,您可以执行以下操作:

# Gemfile

source "https://rubygems.org"
ruby "2.4.2"

# ... your gems on the following lines ...

If you want to uninstall a Ruby version, execute: 如果要卸载Ruby版本,请执行:

$ rvm uninstall <version_number>

So to uninstall version 2.2.5, execute: 因此,要卸载2.2.5版,请执行:

$ rvm uninstall 2.2.5

Note: don't include the $ sign. 注意:请勿包含$符号。 That's just there to represent your terminal window. 那只是代表您的终端窗口。

More information on specifying Ruby versions in your Gemfile can be found at these links: 在以下链接中可以找到有关在Gemfile中指定Ruby版本的更多信息:


If you still experience issues, you may need to install or update bundler : 如果仍然遇到问题,则可能需要安装或更新bundler

$ gem install bundler

or 要么

$ gem update bundler

As your Gemfile specified ruby 2.2.5 and your rvm ruby version is 2.4.2, you can simply update the project gems bundle to fix the issue by doing 由于您的Gemfile指定了ruby 2.2.5,而rvm ruby​​版本是2.4.2,因此您只需更新项目gem捆绑包即可解决此问题

   bundle update

This will update all the gems in your Gemfile file to get compatible with your current ruby version. 这将更新您Gemfile文件中的所有宝石,以与您当前的红宝石版本兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM