简体   繁体   English

已安装RVM捆绑器错误:未安装宝石捆绑器,请先运行`gem install bundler`

[英]RVM bundler installed ERROR: Gem bundler is not installed, run `gem install bundler` first

I get to work with a new project and it's based on ruby 1.8.7, I'm using rvm to manage my ruby versions and I have installed 1.8.7 and 1.9.2. 我开始使用一个新项目,它基于ruby 1.8.7,我使用rvm管理我的ruby版本,并且已经安装了1.8.7和1.9.2。

The thing is when I do: 事情是当我这样做的:

rvm use 1.8.7 

and try to run: 并尝试运行:

bundle install

I get: 我得到:

ERROR: Gem bundler is not installed, run `gem install bundler` first.

I've installed bundler 5 times and even after that it says it's not installed. 我已经安装了5次捆绑器,甚至在此之后它还没有安装。 What can cause this? 是什么原因造成的? Bundle even shows up at my gem list. 捆绑包甚至出现在我的宝石清单中。

update from comments: 从评论更新:

The ouput of the which ruby && which gem is: 红宝石和宝石的输出是:

/home/username/.rvm/rubies/ruby-1.8.7-p371/bin/ruby
/home/username/.rvm/bin/gem

Output of "env | grep -iE 'ruby|rvm|gem' | sort": “ env | grep -iE'ruby | rvm | gem'| sort”的输出:

GEM_HOME=/home/username/.rvm/gems/ruby-1.8.7-p371@global
GEM_PATH=/home/username/.rvm/gems/ruby-1.8.7-p371@global
IRBRC=/home/username/.rvm/rubies/ruby-1.8.7-p371/.irbrc
MY_RUBY_HOME=/home/username/.rvm/rubies/ruby-1.8.7-p371
PATH=/home/username/.rvm/gems/ruby-1.8.7-p371@global/bin:/home/username/.rvm/rubies/ruby-1.8.7-p371/bin:/home/username/.rvm/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
RUBY_VERSION=ruby-1.8.7-p371
rvm_bin_path=/home/username/.rvm/bin
rvm_delete_flag=0
rvm_path=/home/username/.rvm
rvm_prefix=/home/username
rvm_ruby_string=ruby-1.8.7-p371
rvm_sticky_flag=1
rvm_use_flag=1
rvm_version=1.17.7 (stable)

Unistalled and installed 1.8.7 via RVM ran: 已安装并通过RVM安装1.8.7

rvm install 1.8.7 --verify-downloads 1

and it worked. 而且有效。

It looks like you're probably running the wrong version of gem . 看来您运行的是错误版本的gem In my RVM setup, using the shell command overrides recommended with RVM ( source "$HOME/.rvm/scripts/rvm" in your .bashrc or .zshrc or another suitable startup file), gem is normally a shell function. 在我的RVM安装,使用与RVM(建议使用shell命令重写source "$HOME/.rvm/scripts/rvm"在你.bashrc.zshrc或其他合适的启动文件), gem通常是一个shell功能。 It does some RVM magic under the covers and then runs the real gem command. 它在幕后做了一些RVM魔术,然后运行了真正的gem命令。 In my case, both ruby and gem run out of the same version directory: 在我的情况下, rubygem都使用同一版本目录:

/home/jim/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
/home/jim/.rvm/rubies/ruby-1.9.3-p327/bin/gem

Make sure you're sourcing the RVM startup script. 确保您正在采购RVM启动脚本。

Your PATH looks ok. 您的PATH看起来不错。 Make sure you have a /home/username/.rvm/rubies/ruby-1.8.7-p371/bin/gem command. 确保您具有/home/username/.rvm/rubies/ruby-1.8.7-p371/bin/gem命令。 If not, you may have to reinstall ruby-1.8.7. 如果不是,则可能必须重新安装ruby-1.8.7。

Running rvm current will show which Ruby version and gemset are being used. 运行rvm current将显示正在使用哪个Ruby版本和gemset。 Make sure there's a gem in the path that matches the Ruby version. 确保路径中有一个与Ruby版本匹配的gem

rvm install ruby-1.9.2-p320 rvm安装ruby-1.9.2-p320

use this and remember close all terminal and in edit-> profile preferences--> title and command -->> check (Run command as login shell) 使用它并记住关闭所有终端,并在编辑->配置文件首选项->标题和命令->>检查中(将命令作为登录外壳运行)

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

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