Islam Azab
Islam Azab

Reputation: 747

Does nvm have to be before rvm in PATH?

Why does nvm is added before /home/user/.rvm/gems/ruby-2.2.3/bin in PATH ?

echo $PATH
/home/user/.rvm/bin:/home/user/.nvm/versions/node/v5.1.0/bin:/home/user/.rvm/gems/ruby-2.2.3/bin:/home/user/.rvm/gems/ruby-2.2.3@global/bin:/home/user/.rvm/rubies/ruby-2.2.3/bin:/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/user/.rvm/bin

My .zshrc file end looks like this

export NVM_DIR="/home/user/.nvm"

[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh"  # This loads nvm

export PATH="$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

I get the following error because of that.

rvm -v
Warning! PATH is not properly set up, '/home/user/.rvm/gems/ruby-2.2.3/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.2.3'.
rvm 1.26.11 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

Upvotes: 7

Views: 934

Answers (1)

Caleb Adams
Caleb Adams

Reputation: 4905

rvm is expecting to be the first in your PATH. You can disable this warning so that you do not have this issue by adding the following line to your .rvmrc file:

rvm_silence_path_mismatch_check_flag=1

This should disable that warning.

Your .rvmrc file should be located at: ~/.rvmrc. Create it if it does not exist.

Now, make nvm the first in your PATH and place rvm after that.

Upvotes: 3

Related Questions