The command rbenv install is missing

我只是一个虾纸丫 提交于 2019-12-18 10:01:10

问题


In Ubuntu 10.04 I just installed rbenv. The install command it is not present.

rbenv 0.4.0-49-g8b04303
Usage: rbenv <command> [<args>]

Some useful rbenv commands are:
   commands    List all available rbenv commands
   local       Set or show the local application-specific Ruby version
   global      Set or show the global Ruby version
   shell       Set or show the shell-specific Ruby version
   rehash      Rehash rbenv shims (run this after installing executables)
   version     Show the current Ruby version and its origin
   versions    List all Ruby versions available to rbenv
   which       Display the full path to an executable
   whence      List all Ruby versions that contain the given executable

See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/sstephenson/rbenv#readme

What am I missing?


回答1:


The install command is not embedded into rbenv, it comes from the ruby-build plugin. You can install it using the command:

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

On Mac OS X you can install it through homebrew:

brew install ruby-build

On Debian (version >= 7) and Ubuntu (version >= 12.10) both rbenv and ruby-build can be installed using apt-get (or aptitude):

sudo apt-get update
sudo apt-get install rbenv ruby-build

On FreeBSD ruby-build is available in the Ports Collection, it can be install both as a binary package or build from the port:

# Using pkgng rbenv will be installed
pkg install ruby-build

# Building ruby-build form Ports will install rbenv only if the RBENV option is set
cd /usr/ports/devel/ruby-build
make install



回答2:


I found that when using rbenv from a global directory, it's necessary to export the RBENV_ROOT variable, otherwise it won't load the plugins.

export RBENV_ROOT="/usr/local/rbenv"
if [ -d "${RBENV_ROOT}" ]; then
  export PATH="${RBENV_ROOT}/bin:${PATH}"
fi



回答3:


As everyone mentioned problem is missing ruby-build. For older versions of OS ruby-build may not be available as an apt package. In that case install using original instructions, which should've omitted the word Optional in this:

  1. (Optional) Install ruby-build, which provides the rbenv install command that simplifies the process of installing new Ruby versions.
git clone git@github.com:rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
# OR use http
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build



回答4:


Simply install ruby-build in ubuntu:

sudo apt-get install ruby-build

And add

eval "$(rbenv init -)"

To your ~/.bashrc




回答5:


I had installed the ruby-build plugin before and installed ruby 1.9.3-p327 using

$ rbenv install 1.9.3-p327

A few days later I tried to install ruby 2.0.0-p247 using

$ rbenv install 2.0.0-p247

but I received the error message

rbenv: no such command 'install'

All I had to do was to run

$ exec $SHELL -l

and that fixed the problem.




回答6:


Anyone finding their way here with this issue on OSX and already having installed ruby-build via homebrew (like me), you may solve this by just upgrading ruby-build:

brew update
brew upgrade ruby-build

This fixed the problem for me.




回答7:


This issue also happens in Linux when doing a stand-alone installation of ruby-build, if the ruby-build executable is not found in the path. If installing under /usr/local, try for example:

PATH=/usr/local/bin:$PATH /usr/local/bin/rbenv install ...



回答8:


It looks like ruby-build is not present. Run this command :

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build


来源:https://stackoverflow.com/questions/17618113/the-command-rbenv-install-is-missing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!