RVM Gempath not being set

2019-08-22 09:45发布

问题:

I recently installed RVM. After loading my .rvmrc I tried bundle install and got the error informing me bundler was not installed.

After installing bundler, the bundler not installed error persisted. After some quick digging I discovered that the RVM gem paths are not being used by rubygems.

Here is gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.24
  - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/jhalecom/ruby/gems
  - RUBY EXECUTABLE: /home/jhalecom/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
  - EXECUTABLE DIRECTORY: /home/jhalecom/ruby/gems/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/jhalecom/ruby/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--remote --gen-rdoc --run-tests"
     - "gemhome" => "/home/jhalecom/ruby/gems"
     - "gempath" => []
     - "rdoc" => "--inline-source --line-numbers"
  - REMOTE SOURCES:
     - http://rubygems.org/

Here is ~/.bashrc:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions


[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Here is ~/.bash_pofile:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

回答1:

you need to clean your ~/.gemrc, it changes the paths, best would be to rewrite it with :

echo gem: --gen-rdoc --run-tests > ~/.gemrc
echo rdoc: --inline-source --line-numbers >> ~/.gemrc

or to remove the wrong lines:

sed -i '/gemhome|gempath/ d;'