Rbenv 没有正确重新散列和制作垫片
Rbenv not rehashing correctly and making shims
最重要的是,rbenv 不是在制造垫片。我已经用尽了可能是什么问题的想法。经过几天的撞墙修复无果,我想是时候寻求帮助了。
我正在尝试从 RVM 切换到 rbenv,所以这显然是一个因素。任何 ideas/help 都很好。
情况如下:
[09:38] ~ $ gem install pry
Fetching: pry-0.10.2.gem (100%)
Successfully installed pry-0.10.2
1 gem installed
[09:39] ~ $ rbenv rehash
[09:40] ~ $ pry
bash: pry: command not found
[09:40] ~ $ rbenv which pry
rbenv: pry: command not found
[09:40] ~ $ which pry
which: no pry in (/home/caveman/.rbenv/plugins/ruby-build/bin:/home/caveman/.rbenv/shims:/home/caveman/.rbenv/bin:/home/caveman/.rbenv/shims:/home/caveman/.rbenv/bin:/home/caveman/.rbenv/plugins/ruby-build/bin:/home/caveman/.rbenv/shims:/home/caveman/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
[09:41] ~ $ ~/.gem/ruby/2.2.0/bin/pry
[1] pry(main)> puts "I'm working now"
I'm working now
[09:43] ~ $ gem list | grep pry
pry (0.10.2)
这是我的 gem 环境:
[09:44] ~ $ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/caveman/.gem/ruby/2.2.0
- RUBY EXECUTABLE: /home/caveman/.rbenv/versions/2.2.0/bin/ruby
- EXECUTABLE DIRECTORY: /home/caveman/.gem/ruby/2.2.0/bin
- SPEC CACHE DIRECTORY: /home/caveman/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/caveman/.rbenv/versions/2.2.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/caveman/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/caveman/.rbenv/versions/2.2.0/bin
- /usr/lib/rbenv/libexec
- /home/caveman/.rbenv/plugins/ruby-build/bin
- /home/caveman/.rbenv/shims
- /home/caveman/.rbenv/bin
- /home/caveman/.rbenv/shims
- /home/caveman/.rbenv/bin
- /home/caveman/.rbenv/plugins/ruby-build/bin
- /home/caveman/.rbenv/shims
- /home/caveman/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /usr/lib/jvm/default/bin
- /usr/bin/site_perl
- /usr/bin/vendor_perl
- /usr/bin/core_perl
这是我的 .bashrc 文件:
[09:46] ~ $ cat .bashrc
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# If I don't set this, gem reverts back to nonexistent RVM directory.
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
export GEM_PATH=$(ruby -e 'print Gem.user_dir')
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
这里是。bash_profile:
[09:52] ~ $ cat .bash_profile
[[ -f ~/.bashrc ]] && . ~/.bashrc
source ~/.profile
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
我怀疑你的 .bashrc 是问题所在。它不应包含:
# If I don't set this, gem reverts back to nonexistent RVM directory.
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
export GEM_PATH=$(ruby -e 'print Gem.user_dir')
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
在我的 ~/.bashrc、~/.profile 和 ~/.bash_profile 文件中,只有最后一个文件有 rbenv 的配置:
# echo Using rbenv...
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
这是在我安装 rbenv 时创建的,它与我使用 rbenv 的其他系统的设置相匹配,包括一些以前安装了 RVM 的系统。
您的双重 PATH 分配看起来像是罪魁祸首。将我系统的 PATH 与你的系统进行比较,后者由 gem env
:
列出
- /Users/ttm/.rbenv/versions/2.2.3/bin
- /Users/ttm/.rbenv/libexec
- /Users/ttm/.rbenv/plugins/ruby-build/bin
- /Users/ttm/.rbenv/plugins/rbenv-whatis/bin
- /Users/ttm/.rbenv/plugins/rbenv-vars/bin
- /Users/ttm/.rbenv/plugins/rbenv-use/bin
- /Users/ttm/.rbenv/plugins/rbenv-update/bin
- /Users/ttm/.rbenv/plugins/rbenv-update-rubies/bin
- /Users/ttm/.rbenv/plugins/rbenv-gemset/bin
- /Users/ttm/.rbenv/plugins/rbenv-env/bin
- /Users/ttm/.rbenv/plugins/rbenv-each/bin
- /Users/ttm/.rbenv/shims
- /Users/ttm/.rbenv/bin
同样,我的which pry
returns:
/Users/ttm/.rbenv/shims/pry
使用 rbenv 的 env
plugin 显示:
RBENV_VERSION=2.2.3
RBENV_GEMSET_ALREADY=yes
RBENV_ROOT=/Users/ttm/.rbenv
RBENV_HOOK_PATH=:/Users/ttm/.rbenv/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks:/Users/ttm/.rbenv/plugins/rbenv-default-gems/etc/rbenv.d:/Users/ttm/.rbenv/plugins/rbenv-gemset/etc/rbenv.d:/Users/ttm/.rbenv/plugins/rbenv-readline/etc/rbenv.d:/Users/ttm/.rbenv/plugins/rbenv-vars/etc/rbenv.d
PATH=/Users/ttm/.rbenv/versions/2.2.3/bin:/Users/ttm/.rbenv/libexec:/Users/ttm/.rbenv/plugins/ruby-build/bin:/Users/ttm/.rbenv/plugins/rbenv-whatis/bin:/Users/ttm/.rbenv/plugins/rbenv-vars/bin:/Users/ttm/.rbenv/plugins/rbenv-use/bin:/Users/ttm/.rbenv/plugins/rbenv-update/bin:/Users/ttm/.rbenv/plugins/rbenv-update-rubies/bin:/Users/ttm/.rbenv/plugins/rbenv-gemset/bin:/Users/ttm/.rbenv/plugins/rbenv-env/bin:/Users/ttm/.rbenv/plugins/rbenv-each/bin:/Users/ttm/.rbenv/shims:/Users/ttm/.rbenv/bin:/Users/ttm/.pyenv/shims:/Users/ttm/.pyenv/bin:/Users/ttm/perl5/perlbrew/bin:/Users/ttm/perl5/perlbrew/perls/perl-5.18.1/bin:/Users/ttm/bin:/usr/local/mysql-5.6.16-osx10.7-x86_64/bin:/Users/ttm/libsmi/bin:/usr/local/git/bin:/usr/local/bin:/Library/PostgreSQL/9.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin
RBENV_SHELL=bash
RBENV_DIR=/Users/ttm
RUBYLIB=/Users/ttm/.rbenv/rbenv.d/exec/gem-rehash:
我会执行以下步骤:
- 修改 ~/.bashrc 和其他文件,删除任何引用 rbenv and/or RVM 的行。 RVM 使用所有三个初始化文件,加上 .zshrc,而 rbenv 似乎只涉及到 ~/.bash_profile.
- 关闭终端会话。重新打开它。
- 确认 PATH 没有对 RVM 和 rbenv 的所有引用。
- 按照 Installation 说明重新安装 rbenv。它不会覆盖当前安装,而是将其更改重新安装到 ~/.bash_profile.
- 再次关闭终端会话并重新打开。
rbenv 现在应该正确初始化了。
最重要的是,rbenv 不是在制造垫片。我已经用尽了可能是什么问题的想法。经过几天的撞墙修复无果,我想是时候寻求帮助了。
我正在尝试从 RVM 切换到 rbenv,所以这显然是一个因素。任何 ideas/help 都很好。
情况如下:
[09:38] ~ $ gem install pry
Fetching: pry-0.10.2.gem (100%)
Successfully installed pry-0.10.2
1 gem installed
[09:39] ~ $ rbenv rehash
[09:40] ~ $ pry
bash: pry: command not found
[09:40] ~ $ rbenv which pry
rbenv: pry: command not found
[09:40] ~ $ which pry
which: no pry in (/home/caveman/.rbenv/plugins/ruby-build/bin:/home/caveman/.rbenv/shims:/home/caveman/.rbenv/bin:/home/caveman/.rbenv/shims:/home/caveman/.rbenv/bin:/home/caveman/.rbenv/plugins/ruby-build/bin:/home/caveman/.rbenv/shims:/home/caveman/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
[09:41] ~ $ ~/.gem/ruby/2.2.0/bin/pry
[1] pry(main)> puts "I'm working now"
I'm working now
[09:43] ~ $ gem list | grep pry
pry (0.10.2)
这是我的 gem 环境:
[09:44] ~ $ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/caveman/.gem/ruby/2.2.0
- RUBY EXECUTABLE: /home/caveman/.rbenv/versions/2.2.0/bin/ruby
- EXECUTABLE DIRECTORY: /home/caveman/.gem/ruby/2.2.0/bin
- SPEC CACHE DIRECTORY: /home/caveman/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/caveman/.rbenv/versions/2.2.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/caveman/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/caveman/.rbenv/versions/2.2.0/bin
- /usr/lib/rbenv/libexec
- /home/caveman/.rbenv/plugins/ruby-build/bin
- /home/caveman/.rbenv/shims
- /home/caveman/.rbenv/bin
- /home/caveman/.rbenv/shims
- /home/caveman/.rbenv/bin
- /home/caveman/.rbenv/plugins/ruby-build/bin
- /home/caveman/.rbenv/shims
- /home/caveman/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /usr/lib/jvm/default/bin
- /usr/bin/site_perl
- /usr/bin/vendor_perl
- /usr/bin/core_perl
这是我的 .bashrc 文件:
[09:46] ~ $ cat .bashrc
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# If I don't set this, gem reverts back to nonexistent RVM directory.
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
export GEM_PATH=$(ruby -e 'print Gem.user_dir')
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
这里是。bash_profile:
[09:52] ~ $ cat .bash_profile
[[ -f ~/.bashrc ]] && . ~/.bashrc
source ~/.profile
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
我怀疑你的 .bashrc 是问题所在。它不应包含:
# If I don't set this, gem reverts back to nonexistent RVM directory.
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
export GEM_PATH=$(ruby -e 'print Gem.user_dir')
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
在我的 ~/.bashrc、~/.profile 和 ~/.bash_profile 文件中,只有最后一个文件有 rbenv 的配置:
# echo Using rbenv...
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
这是在我安装 rbenv 时创建的,它与我使用 rbenv 的其他系统的设置相匹配,包括一些以前安装了 RVM 的系统。
您的双重 PATH 分配看起来像是罪魁祸首。将我系统的 PATH 与你的系统进行比较,后者由 gem env
:
- /Users/ttm/.rbenv/versions/2.2.3/bin
- /Users/ttm/.rbenv/libexec
- /Users/ttm/.rbenv/plugins/ruby-build/bin
- /Users/ttm/.rbenv/plugins/rbenv-whatis/bin
- /Users/ttm/.rbenv/plugins/rbenv-vars/bin
- /Users/ttm/.rbenv/plugins/rbenv-use/bin
- /Users/ttm/.rbenv/plugins/rbenv-update/bin
- /Users/ttm/.rbenv/plugins/rbenv-update-rubies/bin
- /Users/ttm/.rbenv/plugins/rbenv-gemset/bin
- /Users/ttm/.rbenv/plugins/rbenv-env/bin
- /Users/ttm/.rbenv/plugins/rbenv-each/bin
- /Users/ttm/.rbenv/shims
- /Users/ttm/.rbenv/bin
同样,我的which pry
returns:
/Users/ttm/.rbenv/shims/pry
使用 rbenv 的 env
plugin 显示:
RBENV_VERSION=2.2.3
RBENV_GEMSET_ALREADY=yes
RBENV_ROOT=/Users/ttm/.rbenv
RBENV_HOOK_PATH=:/Users/ttm/.rbenv/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks:/Users/ttm/.rbenv/plugins/rbenv-default-gems/etc/rbenv.d:/Users/ttm/.rbenv/plugins/rbenv-gemset/etc/rbenv.d:/Users/ttm/.rbenv/plugins/rbenv-readline/etc/rbenv.d:/Users/ttm/.rbenv/plugins/rbenv-vars/etc/rbenv.d
PATH=/Users/ttm/.rbenv/versions/2.2.3/bin:/Users/ttm/.rbenv/libexec:/Users/ttm/.rbenv/plugins/ruby-build/bin:/Users/ttm/.rbenv/plugins/rbenv-whatis/bin:/Users/ttm/.rbenv/plugins/rbenv-vars/bin:/Users/ttm/.rbenv/plugins/rbenv-use/bin:/Users/ttm/.rbenv/plugins/rbenv-update/bin:/Users/ttm/.rbenv/plugins/rbenv-update-rubies/bin:/Users/ttm/.rbenv/plugins/rbenv-gemset/bin:/Users/ttm/.rbenv/plugins/rbenv-env/bin:/Users/ttm/.rbenv/plugins/rbenv-each/bin:/Users/ttm/.rbenv/shims:/Users/ttm/.rbenv/bin:/Users/ttm/.pyenv/shims:/Users/ttm/.pyenv/bin:/Users/ttm/perl5/perlbrew/bin:/Users/ttm/perl5/perlbrew/perls/perl-5.18.1/bin:/Users/ttm/bin:/usr/local/mysql-5.6.16-osx10.7-x86_64/bin:/Users/ttm/libsmi/bin:/usr/local/git/bin:/usr/local/bin:/Library/PostgreSQL/9.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin
RBENV_SHELL=bash
RBENV_DIR=/Users/ttm
RUBYLIB=/Users/ttm/.rbenv/rbenv.d/exec/gem-rehash:
我会执行以下步骤:
- 修改 ~/.bashrc 和其他文件,删除任何引用 rbenv and/or RVM 的行。 RVM 使用所有三个初始化文件,加上 .zshrc,而 rbenv 似乎只涉及到 ~/.bash_profile.
- 关闭终端会话。重新打开它。
- 确认 PATH 没有对 RVM 和 rbenv 的所有引用。
- 按照 Installation 说明重新安装 rbenv。它不会覆盖当前安装,而是将其更改重新安装到 ~/.bash_profile.
- 再次关闭终端会话并重新打开。
rbenv 现在应该正确初始化了。