ruby 警告!PATH设置不正确,一般是shell初始化文件引起的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17968580/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Warning! PATH is not properly set up, usually this is caused by shell initialization files
提问by Santhosh
Whenever I go to a folder with a .rvmrcfile, there is a warning:
每当我转到带有文件的.rvmrc文件夹时,都会出现警告:
Warning! PATH is not properly set up, '/home/me/.rvm/gems/ruby-2.0.0-p247/bin' is not available,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
to fix run: 'rvm use ruby-2.0.0-p247'.
I did rvm use ruby-2.0.0-p247, but the warning is still present.
我做了rvm use ruby-2.0.0-p247,但警告仍然存在。
Note: There are no errors, Im able to run my application just fine, but the warning is very annoying. Any ideas?
注意:没有错误,我可以很好地运行我的应用程序,但是警告很烦人。有任何想法吗?
采纳答案by mpapis
This was a bug and was handled with https://github.com/wayneeseguin/rvm/issues/2050and was released as rvm stable 1.21.15at 2013-07-29 19:15:30 -0700
这是一个错误,由https://github.com/wayneeseguin/rvm/issues/2050处理,并1.21.15于 2013-07-29 19:15:30 -0700作为 rvm stable 发布
回答by Sam
I was getting the same warning even after upgrading RVM to version 1.25.16. I was able to fix the warning by running:
即使将 RVM 升级到 1.25.16 版,我也收到了同样的警告。我能够通过运行来修复警告:
rvm reset
Then when I ran:
然后当我跑:
rvm version
I did not receive the error anymore. Hope this helps!
我没有再收到错误消息。希望这可以帮助!
回答by Jim Stewart
If you know what you're doing, and your PATHis set to what you want, you can suppress this message by putting the following in your ~/.rvmrc:
如果您知道自己在做什么,并且PATH设置为您想要的,则可以通过将以下内容放入您的 中来抑制此消息~/.rvmrc:
rvm_silence_path_mismatch_check_flag=1
This is handy if you use other path-manipulating programs like virtualenv, or if you just want to prefix your path with ~/binor something.
如果您使用其他路径操作程序(如 virtualenv),或者您只想为路径添加前缀或其他内容,这会很方便~/bin。
回答by Santhosh
I was able to get rid of this by doing
我能够通过这样做来摆脱这个
rvm get head
回答by zuozuo
I had the same problem too, and rvm get headdidn't work for me, finally it was solved by running rvm get head --auto-dotfiles, then restarted the terminal and the annoying warning message disappeared! And the solution is found here: https://github.com/wayneeseguin/rvm/issues/2074Hope this will help.
我也遇到了同样的问题,rvm get head对我不起作用,最后通过运行解决了rvm get head --auto-dotfiles,然后重新启动终端,烦人的警告信息消失了!解决方案在这里:https: //github.com/wayneeseguin/rvm/issues/2074希望这会有所帮助。
回答by webdevguy
rvm get stablesolved this for me
rvm get stable为我解决了这个问题
(as pointed out in comments on another answer by AndrewMarshall)
(正如安德鲁马歇尔在对另一个答案的评论中指出的那样)
回答by bgillies
Okay, so I ran an export PATHcommand without realizing the implications and ran into the identical error, but I also lost all control of my typical commands like cd and pwd. I didn't want to reset the rvm tools I'd already installed per some of the answers above.
好的,所以我在export PATH没有意识到含义的情况下运行了一个命令并遇到了相同的错误,但我也失去了对 cd 和 pwd 等典型命令的所有控制。我不想根据上面的一些答案重置我已经安装的 rvm 工具。
First attempt was to some sort of mac default path (found on google):
第一次尝试是某种 mac 默认路径(在谷歌上找到):
$ export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
Which actually solved my first problem of not having access to my typical command line tools, but was still getting the same error as @Santosh's initial problem. The next thing I did was navigate to my directory where I've set up rvm to start, and then to run a new export command as follows:
这实际上解决了我无法访问典型命令行工具的第一个问题,但仍然遇到与@Santosh 最初问题相同的错误。我做的下一件事是导航到我设置了 rvm 的目录来启动,然后运行一个新的导出命令,如下所示:
$ export PATH="$PATH"
This was how I initially set up rvm, and no more errors. Hope this helps someone
这就是我最初设置 rvm 的方式,没有更多错误。希望这有助于某人
回答by Vaibhav
Solved!
解决了!
Warning! PATH is not properly set up, '/home/vaibhav/.rvm/gems/ruby-2.3.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.3.1'.
警告!PATH 未正确设置,'/home/vaibhav/.rvm/gems/ruby-2.3.1/bin' 不是最重要的,通常这是由 shell 初始化文件引起的 - 检查它们是否有 'PATH=... ' 条目,它也可能有助于将 RVM 重新添加到您的点文件中:'rvm get stable --auto-dotfiles',在此 shell 会话运行中临时修复:'rvm use ruby-2.3.1'。
rvm get stable --auto-dotfiles
Next you might get below Error:
接下来你可能会得到以下错误:
RVM is not a function, selecting rubies with ‘rvm use …' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use /bin/bash --login as the command.
RVM 不是一个函数,选择带有“rvm use ...”的红宝石将不起作用。您需要更改终端模拟器首选项以允许登录 shell。有时需要使用 /bin/bash --login 作为命令。
Please visit http://www.rortuts.com/ruby/rvm-path-is-not-properly-set-up/for an example.
请访问http://www.rortuts.com/ruby/rvm-path-is-not-properly-set-up/获取示例。

