我在尝试升级我的ruby版本时最近遇到了来自rvm的以下错误。
Warning! PATH is not properly set up, '/home/sam/.rvm/gems/ruby-2.2.1/bin' is not at first place,
我的echo $PATH
如下:
/usr/local/heroku/bin:/home/sam/.rvm/gems/ruby-2.2.1/bin:/home/sam/.rvm/gems/ruby-2.2.1@global/bin:/home/sam/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin
我的.bashrc中有以下几行
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
.bash_profile有:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
我的rvm info
如下
Warning! PATH is not properly set up, '/home/sam/.rvm/gems/ruby-2.2.1/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.1'.
ruby-2.2.1:
system:
uname: "Linux bitey0asus 3.13.0-77-generic #121-Ubuntu SMP Wed Jan 20 10:50:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/14.04/x86_64"
bash: "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "10 minutes 55 seconds ago"
path: "/home/sam/.rvm"
ruby:
interpreter: "ruby"
version: "2.2.1p85"
date: "2015-02-26"
platform: "x86_64-linux"
patchlevel: "2015-02-26 revision 49769"
full_version: "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]"
homes:
gem: "/home/sam/.rvm/gems/ruby-2.2.1"
ruby: "/home/sam/.rvm/rubies/ruby-2.2.1"
binaries:
ruby: "/home/sam/.rvm/rubies/ruby-2.2.1/bin/ruby"
irb: "/home/sam/.rvm/rubies/ruby-2.2.1/bin/irb"
gem: "/home/sam/.rvm/rubies/ruby-2.2.1/bin/gem"
rake: "/home/sam/.rvm/rubies/ruby-2.2.1/bin/rake"
environment:
PATH: "/usr/local/heroku/bin:/home/sam/.rvm/gems/ruby-2.2.1/bin:/home/sam/.rvm/gems/ruby-2.2.1@global/bin:/home/sam/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin"
GEM_HOME: "/home/sam/.rvm/gems/ruby-2.2.1"
GEM_PATH: "/home/sam/.rvm/gems/ruby-2.2.1:/home/sam/.rvm/gems/ruby-2.2.1@global"
MY_RUBY_HOME: "/home/sam/.rvm/rubies/ruby-2.2.1"
IRBRC: "/home/sam/.rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
gemset: ""
我找到了类似问题的解决方案here.但显然不够接近(建议的解决方案没有效果)。
无论如何,如果有人有任何想法,我会很感激。我对rvm的细节一点点毫无头绪,所以我在这里有点黑暗。提前致谢
修改
我尝试在.bashrc
中反转两个rvm行的顺序,但这对错误没有帮助,也没有改变echo $PATH
显示的顺序。
答案 0 :(得分:1)
您的PATH
并非以/home/sam/.rvm/gems/ruby-2.2.1/bin
开头,因为您的行前面有Heroku工具带路径。
您可以在终端中运行此功能来检查是否属实:
PATH=/home/sam/.rvm/gems/ruby-2.2.1/bin:$PATH rvm info
它不应该抱怨。
问题来自于Heroku工具带以rvm无法照顾的方式修改你的环境。
根据{{3}},修复方法是更改.bashrc
,如此:
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
您可以从.bash_profile
答案 1 :(得分:0)
为了解决这个问题,我刚刚更改了我的.profile文件:
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
到
PATH="$PATH:$HOME/bin:$HOME/.local/bin"