I have the multi-user version of RVM installed in /usr/local/rvm/bin
on Ubuntu 12.10. When I upgraded Ruby from 1.9.3 to 2.0.0 this seems to have caused the following error message to pop up whenever I execute rvm version
or similar commands:
我在Ubuntu 12.10的/usr/local/rvm/bin上安装了多用户版本的RVM。当我将Ruby从1.9.3升级到2.0.0时,当我执行rvm版本或类似的命令时,这似乎导致了以下错误消息的出现:
$ rvm version
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.0.0-p247/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.0.0-p247'.
rvm 1.22.16 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
I have tried the suggestions listed in similar questions, but rvm get head
and rvm get head --auto-dotfiles
did not help.
我已经尝试了类似问题中列出的建议,但是rvm得到head和rvm得到head——自动dotfiles没有帮助。
I have the following at the very end of my .bashrc
:
在我的。bashrc的结尾有以下内容:
PATH=$PATH:/usr/local/rvm/bin # Add RVM to PATH for scripting
And my path is:
和我的路径是:
$ echo $PATH
./bin:/usr/local/sbin:/usr/local/bin:/usr/local/rvm/gems/ruby-2.0.0-p247/bin:/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p247/bin:/usr/local/rvm/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ which rvm
/usr/local/rvm/bin/rvm
$ which ruby
/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
3 个解决方案
#1
4
RVM and PATH
RVM expects to find its bin directory first in your PATH. RVM really, really wants to ensure that it takes precedence over any system binaries or gems. To make a system install of RVM happy, your PATH statement should look similar to:
RVM希望在您的路径中找到它的bin目录。RVM确实需要确保它优先于任何系统二进制文件或gem。要使RVM的系统安装愉快,您的路径声明应该类似于:
PATH=/usr/local/rvm/bin:$PATH
whereas you currently have that inverted. This is generally The Right Thing™ to do.
而你现在是倒转的。这通常是正确的事™。
Ignoring the Error
If you really know what you're doing, you can add:
如果你真的知道自己在做什么,你可以补充:
rvm_silence_path_mismatch_check_flag=1
to your /etc/rvmrc or ~/.rvmrc file. This will prevent RVM from complaining about not being first in the PATH, but is very likely to cause problems for most people.
到你的/etc/rvmrc或~/。rvmrc文件。这将防止RVM抱怨在路径上不是第一个,但是很可能会给大多数人带来问题。
There may be legitimate edge cases where this is necessary, such as having Ruby-related wrapper scripts in ~/bin that you want to take precedence. However, debugging Ruby and RVM will be much harder, so you should remember to check which -a <ruby|gem>
as your first troubleshooting step if you have this option enabled.
在必要的情况下,可能会出现一些合法的边界情况,比如在~/bin中有您希望优先使用的ruby相关的包装脚本。但是,调试Ruby和RVM将会更加困难,所以您应该记住,如果您启用了这个选项,那么您应该检查哪个a < Ruby |gem>作为您的第一个故障排除步骤。
#2
0
Your PATH
includes ./bin:/usr/local/sbin:/usr/local/bin
on beginning, as much as I can agree that it is good to keep /usr/local/sbin:/usr/local/bin
on the beginning I need to warn you it is extremely dangerous to keep ./bin
at the first place, it is like begging to hijack your computer, this is one of the biggest security issues regarding to distributed work and working with pubic repositories.
你的路径包括。/ bin:/ usr /地方/ sbin:/ usr /地方/ bin开始,尽我所能同意这是保持/usr/local/sbin:/ usr /地方/ bin一开始我需要警告你是极其危险的。/ bin在第一个地方,它就像乞讨劫持你的电脑,这是一个最大的安全问题对于分布式工作和处理公共存储库。
Otherwise the answer form @CodeGnome is pretty accurate except this small detail.
否则,除了这个小细节外,@CodeGnome的答案是相当准确的。
#3
0
I've found that it's /etc/profile.d/rvm.sh
that seems to be causing the problem. Link to its content: https://gist.github.com/armhold/6832283.
我发现它是/etc/profile.d/rvm。这似乎是造成问题的原因。链接到它的内容:https://gist.github.com/armhold/6832283。
If I chmod it to remove read/execute bits I find that rvm is happy again.
如果我修改它以删除读/执行比特,我发现rvm又高兴了。
I wonder if there is not an update to this script that should be manually installed...
我想知道这个脚本的更新是否应该手动安装……
#1
4
RVM and PATH
RVM expects to find its bin directory first in your PATH. RVM really, really wants to ensure that it takes precedence over any system binaries or gems. To make a system install of RVM happy, your PATH statement should look similar to:
RVM希望在您的路径中找到它的bin目录。RVM确实需要确保它优先于任何系统二进制文件或gem。要使RVM的系统安装愉快,您的路径声明应该类似于:
PATH=/usr/local/rvm/bin:$PATH
whereas you currently have that inverted. This is generally The Right Thing™ to do.
而你现在是倒转的。这通常是正确的事™。
Ignoring the Error
If you really know what you're doing, you can add:
如果你真的知道自己在做什么,你可以补充:
rvm_silence_path_mismatch_check_flag=1
to your /etc/rvmrc or ~/.rvmrc file. This will prevent RVM from complaining about not being first in the PATH, but is very likely to cause problems for most people.
到你的/etc/rvmrc或~/。rvmrc文件。这将防止RVM抱怨在路径上不是第一个,但是很可能会给大多数人带来问题。
There may be legitimate edge cases where this is necessary, such as having Ruby-related wrapper scripts in ~/bin that you want to take precedence. However, debugging Ruby and RVM will be much harder, so you should remember to check which -a <ruby|gem>
as your first troubleshooting step if you have this option enabled.
在必要的情况下,可能会出现一些合法的边界情况,比如在~/bin中有您希望优先使用的ruby相关的包装脚本。但是,调试Ruby和RVM将会更加困难,所以您应该记住,如果您启用了这个选项,那么您应该检查哪个a < Ruby |gem>作为您的第一个故障排除步骤。
#2
0
Your PATH
includes ./bin:/usr/local/sbin:/usr/local/bin
on beginning, as much as I can agree that it is good to keep /usr/local/sbin:/usr/local/bin
on the beginning I need to warn you it is extremely dangerous to keep ./bin
at the first place, it is like begging to hijack your computer, this is one of the biggest security issues regarding to distributed work and working with pubic repositories.
你的路径包括。/ bin:/ usr /地方/ sbin:/ usr /地方/ bin开始,尽我所能同意这是保持/usr/local/sbin:/ usr /地方/ bin一开始我需要警告你是极其危险的。/ bin在第一个地方,它就像乞讨劫持你的电脑,这是一个最大的安全问题对于分布式工作和处理公共存储库。
Otherwise the answer form @CodeGnome is pretty accurate except this small detail.
否则,除了这个小细节外,@CodeGnome的答案是相当准确的。
#3
0
I've found that it's /etc/profile.d/rvm.sh
that seems to be causing the problem. Link to its content: https://gist.github.com/armhold/6832283.
我发现它是/etc/profile.d/rvm。这似乎是造成问题的原因。链接到它的内容:https://gist.github.com/armhold/6832283。
If I chmod it to remove read/execute bits I find that rvm is happy again.
如果我修改它以删除读/执行比特,我发现rvm又高兴了。
I wonder if there is not an update to this script that should be manually installed...
我想知道这个脚本的更新是否应该手动安装……