为什么在/home/user/.rvm/gems/ruby-2.2.3/bin
之前添加nvm
在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
我的
.zshrc
文件结尾看起来像这样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*
因此,我得到以下错误。
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/]
最佳答案
rvm
有望成为PATH
中的第一个。您可以通过将以下行添加到.rvmrc
文件中来禁用此警告,以免出现此问题:
rvm_silence_path_mismatch_check_flag=1
这应该禁用该警告。
您的
.rvmrc
文件应位于:~/.rvmrc
。如果它不存在,则创建它。现在,将
nvm
设为PATH
中的第一个,然后在其后放置rvm
。关于rvm - nvm是否必须在PATH中的rvm之前?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36200688/