简体   繁体   English

rbenv 未显示可用的 ruby​​ 版本

[英]rbenv not showing the available ruby versions

I have installed rbenv in my vagrant machine but when I try to list all the available ruby versions rbenv versions then it gives me this output:我已经在我的 vagrant 机器上安装了rbenv ,但是当我尝试列出所有可用的 ruby​​ 版本rbenv versions它给了我这个输出:

system (set by /home/vagrant/.rbenv/version)

Does anyone know what is this?有谁知道这是什么?

Are you asking what the output of that command means?你问那个命令的输出是什么意思? I'm looking at the rbenv documentation , and I think it indicates that rbenv only knows of one version of ruby - the version that came installed with your system.我正在查看rbenv 文档,我认为它表明 rbenv 只知道一个版本的 ruby​​ - 随系统安装的版本。

Edit: If that's not the answer you were looking for, can you tell us what you expected to see?编辑:如果这不是您想要的答案,您能告诉我们您希望看到什么吗? Did you have other versions installed on that machine?那台机器上是否安装了其他版本?

Edit 2: If you want to see a list of versions you can install onto your machine, but aren't installed yet, run:编辑 2:如果您想查看可以安装到机器上但尚未安装的版本列表,请运行:

rbenv install --list

Here is more documentation for this command .这里是这个命令的更多文档 This will help!这会有所帮助!

If you have tried both rbenv install --list and ruby-build --definitions and still can't see the latest Ruby versions on the list, then you need to upgrade ruby-build because that is what rbenv uses to "know" the available versions.如果您已经尝试了rbenv install --listruby-build --definitions并且仍然看不到列表中的最新 Ruby 版本,那么您需要升级ruby-build因为这是rbenv用来“知道”可用版本。

For example, assuming you use Mac OS X and installed ruby-build using Homebrew, you can update ruby-build by invoking:例如,假设您使用 Mac OS X 并使用 Homebrew 安装ruby-build ,您可以通过调用来更新ruby-build

brew upgrade ruby-build

Now, try listing the available versions again, and you should see the latest ones there.现在,再次尝试列出可用版本,您应该会在那里看到最新版本。

Edit:编辑:

The ruby-build wiki lists a couple of ways of updating it, namely the above one using Homebrew and another one where it is installed as a plugin to rbenv : ruby-build wiki列出了几种更新它的方法,即上述一种使用 Homebrew 和另一种将其作为插件安装到rbenv

cd "$(rbenv root)"/plugins/ruby-build && git pull

Rbenv is usually installed with it's companion ruby-build rbenv 通常与它的伴侣ruby-build一起安装

You can get the versions available to be installed with:您可以获得可用于安装的版本:

ruby-build --definitions

To get a list of available ruby versions you can install, type the following:要获取可以安装的可用 ruby​​ 版本列表,请键入以下内容:

rbenv install -l

To get a list of the ruby versions already installed on your machine, type the following:要获取机器上已安装的 ruby​​ 版本列表,请键入以下内容:

rbenv versions


To answer your question as to what the below means:回答您关于以下含义的问题:

system (set by /home/vagrant/.rbenv/version)

This is telling you that the system ruby (the default ruby installed on your system) is the only ruby version installed on your vagrant machine.这告诉您系统 ruby​​(系统上安装的默认 ruby​​)是您的 vagrant 机器上安装的唯一 ruby​​ 版本。 Rbenv is using the default system ruby because it doesn't have any other ruby versions installed yet. Rbenv 使用默认系统 ruby​​,因为它还没有安装任何其他 ruby​​ 版本。

If you are on Mac brew upgrade rbenv ruby-build also works.如果您使用 Mac brew upgrade rbenv ruby-build也可以。 Documentation文档

To see all available versions:查看所有可用版本:

rbenv install --list-all

Or要么

rbenv install --list

To list only stable releases for each Ruby implementation.仅列出每个 Ruby 实现的稳定版本。

List rbenv versions that are possible to install列出可以安装的rbenv版本

"Only latest stable releases for each Ruby implementation are shown. “只显示了每个 Ruby 实现的最新稳定版本。

With the fewest key strokes (shorter than --list and --list-all)最少的击键次数(比 --list 和 --list-all 短)

rbenv install -l 

Want to see what is available from rbenv to install?想看看 rbenv 有什么可供安装?

ruby-build --definitions

Want to narrow that down a bit?想要缩小一点吗?

ruby-build --definitions | grep 3.0

To upgrade to the latest rbenv and update ruby-build with newly released Ruby versions, upgrade the Homebrew packages:要升级到最新的 rbenv 并使用新发布的 Ruby 版本更新 ruby​​-build,请升级 Homebrew 包:

brew update && brew upgrade rbenv ruby-build

Also you can always just type rbenv Which will give you a help menu你也可以随时输入rbenv这会给你一个帮助菜单

rbenv 

TLDR the manpage or github repo or just plain forgot? TLDR 联机帮助页或 github 存储库还是只是忘记了?

Take a peek at this site for quick rbenv recollection:看一眼这个站点,快速回忆rbenv

https://devhints.io/rbenv https://devhints.io/rbenv

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

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