简体   繁体   English

最新执行rvm ruby​​gems时出错

[英]Error when executing rvm rubygems latest

I'm adding ruby 1.9.2 to a Mac running 10.6.8 and hitting a problem with rvm rubygems latest . 我将ruby 1.9.2添加到运行10.6.8的Mac上,并遇到了rvm ruby​​gems最新问题。 I've run the following with no problem: 我已经成功运行了以下命令:

$ rvm install 1.9.2
$ rvm use 1.9.2
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]

Then hit this error: 然后打这个错误:

$ rvm rubygems latest
Removing old Rubygems files...
Installing rubygems-1.8.10 for system ...
ERROR: Error running 'GEM_PATH=":@global" GEM_HOME="" "/usr/local/rvm/rubies//bin/ruby" "/usr/local/rvm/src/rubygems-1.8.10/setup.rb"', please read /usr/local/rvm/log/system/rubygems.install.log
WARN: Installation of rubygems did not complete successfully.
ln: /usr/local/rvm/rubies//lib/ruby/gems/: No such file or directory

The obvious thing here is the extra forward-slash in the bin/ruby and lib/ruby paths. 显而易见,bin / ruby​​和lib / ruby​​路径中的多余的正斜杠。 Any ideas where this is coming from and how to fix it? 任何想法这是从哪里来的以及如何解决它?

Note that I've also got the following line at the end of my .bash_profile file: 请注意,我的.bash_profile文件末尾还有以下行:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

I'm doing all of this so that I can run Octopress. 我正在做所有这些工作,以便可以运行Octopress。 I've also got a Rails 2.3.8 project that I am developing on this same machine. 我还有一个在同一台机器上开发的Rails 2.3.8项目。 This is the first time I've dealt with anything other then the system version of ruby (1.8.7). 这是我第一次处理ruby的系统版本(1.8.7)以外的任何其他问题。

I've had the same problem, and although I didn't really fully understood why it was happening, attacking the main symptom solved it for me. 我遇到了同样的问题,尽管我并没有真正完全理解为什么会发生这种情况,但是攻击主要症状可以为我解决。

It seems that you have already another version of ruby installed on your system. 看来您的系统上已经安装了另一个版本的ruby。 The line on the rvm rubygems script that generates the error is this: rvm ruby​​gems脚本上生成错误的行是这样的:

__rvm_run "rubygems.install" \\ "GEM_PATH=\\"$GEM_PATH:${GEM_PATH%%@*}@global\\" GEM_HOME=\\"$GEM_HOME\\" \\"${rvm_ruby_binary}\\" \\"${rvm_src_path}/$rvm_gem_package_name/setup.rb\\"" \\ "Installing $rvm_gem_package_name for ${rvm_ruby_string} ..." https://github.com/wayneeseguin/rvm/blob/master/scripts/rubygems#L104 __rvm_run "rubygems.install" \\ "GEM_PATH=\\"$GEM_PATH:${GEM_PATH%%@*}@global\\" GEM_HOME=\\"$GEM_HOME\\" \\"${rvm_ruby_binary}\\" \\"${rvm_src_path}/$rvm_gem_package_name/setup.rb\\"" \\ "Installing $rvm_gem_package_name for ${rvm_ruby_string} ..." https://github.com/wayneeseguin/rvm/blob/master/scripts/rubygems#L104

I think that internally rvm is losing itself and creating paths with the double slash on it, probably because RVM is appending the RVM local dir with the output of some command similar to which ruby (or whatever the path rvm is searching for may be). 我认为内部rvm正在丢失自身并在其上创建带有双斜杠的路径,这可能是因为RVM在RVM本地目录后附加了某些命令的输出,类似于which ruby (或rvm搜索的路径可能是什么)。 I really don't know why it does that (doesn't RVM work in a system with ruby installed?). 我真的不知道为什么这样做(RVM在安装了ruby的系统中不起作用吗?)。

Anyhow, to fix that in my machine I simply ran sudo aptitude purge ruby (you would of course run the MAC equivalent of that), to remove the ruby version that was messing with rvm. 无论如何,要修复此问题,我只需运行sudo aptitude purge ruby (您当然会运行与之等效的MAC),以删除与rvm混淆的ruby版本。

If you have something related with ruby installed on your computer, I think a good idea would be to remove them all, and use RVM to manage all your ruby related goodness. 如果您的计算机上安装了与红宝石相关的产品,我认为最好将它们全部删除,然后使用RVM来管理与红宝石相关的所有优势。

On linux (debian/ubuntu), a good approach is typing dpkg -l | grep ruby 在Linux(debian / ubuntu)上,一种好的方法是键入dpkg -l | grep ruby dpkg -l | grep ruby to see which packages related to ruby are installed on your machine, and then purge them all. dpkg -l | grep ruby查看与您的计算机相关的软件包,然后清除它们。

After that, run 之后,运行

$ rvm use 1.9.2
$ rvm rubygems latest

Everything should work like a charm. 一切都应该像魅力一样运作。 At least uninstalling ruby worked for me. 至少卸载ruby对我有用。

Hope it helps. 希望能帮助到你。

I just ran rvm default which allowed everything to work properly. 我只是运行了rvm default ,它允许一切正常工作。 I fields is right that rvm hasn't set something completely or at all. 我认为rvm尚未完全设置或完全不设置任何内容是正确的。 This has actually fixed this problem for me consistently. 这实际上一直为我解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM