RVM Bundle Install Missing Gem Error even though g

2019-01-30 05:59发布

I'm getting the following error even though I currently do have the Bundler gem installed (it appears when I run $gem list).

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

I'm using RVM and my $PATH is as follows:

/Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@rails3tutorial2ndEd/bin:
/Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@global/bin:
/Users/cjstingl/.rvm/rubies/ruby-1.9.2-p290/bin:
/Users/cjstingl/.rvm/bin:
/Users/cjstingl/.bin:
/usr/local/sbin:
/usr/local/Cellar/php/5.3.6/bin:
/usr/local/share/python:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/usr/local/bin:
/usr/X11/bin

Also this is my gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-darwin11.2.0]
  - INSTALLATION DIRECTORY: /Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@rails3tutorial2ndEd
  - RUBY EXECUTABLE: /Users/cjstingl/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@rails3tutorial2ndEd/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-11
  - GEM PATHS:
     - /Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@rails3tutorial2ndEd
     - /Users/cjstingl/.rvm/gems/ruby-1.9.2-p290@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => false
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "-n/usr/local/bin --no-ri --no-rdoc --no-user-install"
  - REMOTE SOURCES:
     - http://rubygems.org/

Also: Using the bundle -v command returns the same error

I've tried imploding RVM and reinstalling which doesn't seem to work. I'm stumped and any help would be appreciated.

19条回答
看我几分像从前
2楼-- · 2019-01-30 06:50

I installed ruby 1.9.3 by rvm. After git octopress completed, just edit $path_of_git/.rvmrc like this "rvm use 1.9.3". AND THEN run command of "cd ..; cd $path_of_git". After that it will ask you weather trust the .rvmrc or not. Type 'y' to make .rvmrc file work.

查看更多
老娘就宠你
3楼-- · 2019-01-30 06:50

For my setup, adding the user that apache runs as to the rvm group worked

usermod -a -G rvm www-data
查看更多
叛逆
4楼-- · 2019-01-30 06:51

This works for me when I specify the version of Ruby I want to use:

$ rvm use 1.9.2-p290
Using /Users/myname/.rvm/gems/ruby-1.9.2-p290
查看更多
forever°为你锁心
5楼-- · 2019-01-30 06:53

Adding the following (taken from .bash_profile) to .bashrc fixed it for me:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 
查看更多
在下西门庆
6楼-- · 2019-01-30 06:53

Ran into this problem myself after updating my Ruby patch level. I ran which gem and discovered that it was using a global version of rubygems, in this case the path was ~/.rvm/bin/gem. So I ran rvm rubygems current, which installed it in ~/.rvm/rubies/ruby-1.8.7-p370/bin/gem. Ran gem install bundler and bundle again. Problem solved.

查看更多
劳资没心,怎么记你
7楼-- · 2019-01-30 06:54

I don't know if it's the cause of your problem. But I had a similar problem. The reason was that my RVM environment wasn't correctly.

I had 2 users, one which was working one that didn't. The working user used the following bundle script. (output from: which bundle)

/home/rvm/.rvm/gems/ruby-1.9.3-p0/bin/bundle

The wrong rvm-installation user used:

/home/user/.rvm/bin/bundle

The reason for this is the wrong $PATH order. The .rvm/gems/ruby-.../bin path should be placed before the ./rvm/bin path.

In my situation the cause was I set the $PATH variable to a rvm of another user. I fixed the issue by adding a symbolic link to the RVM of the user and changing my path from:

/home/rvm/.rvm/bin

to

/home/user/.rvm/bin

When the code above does not work for you, you can manually adjust the path just AFTER loading rvm.

查看更多
登录 后发表回答