Ruby Gems 未安装,在获取 Gems 时挂起

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2671749/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 22:33:29  来源:igfitidea点击:

Ruby Gems Not Installing, Hangs While Getting Gems

ruby-on-railsrubymacosrubygems

提问by Tim Hoolihan

I recently cleared out all of my ruby install and installed form sources using the instructions at hivelogic

我最近使用hivelogic 上的说明清除了我所有的 ruby​​ 安装和安装的表单源

I have have been able to install a few gems, but most of the time, "sudo gem install rails" hangs. I've added the -V flag, and it just seems to hang, I don't get any error. And the process can not be killed. I can only reboot to kill the process.

我已经能够安装一些 gem,但大多数时候,“sudo gem install rails”挂起。我添加了 -V 标志,它似乎挂了,我没有收到任何错误。并且进程不能被杀死。我只能重新启动以终止该进程。

My ruby info:

我的红宝石信息:

[tim@ ~]# ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.2.0]
[tim@ ~]# gem -v
1.3.6
[tim@ ~]# gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.6
  - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.2.0]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/1.8
     - /Users/tim/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org/", "http://gems.rubyforge.org"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gems.rubyforge.org
[tim@ ~]# which ruby
/usr/local/bin/ruby
[tim@ ~]# which gem
/usr/local/bin/gem
[tim@ ~]# uname -a
Darwin tim-hoolihans-macbook-pro-15.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386
[tim@ ~]# 

Any ideas?

有任何想法吗?

Answer:

回答:

I built again with the following line and don't have the problem now:

我用以下行再次构建,现在没有问题:

ARCHFLAGS='-arch i386 -arch ppc -arch ppc64 -arch x86_64' sudo ./configure --enable--shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1

回答by Leopd

For me

为了我

sudo gem install rails -V

showed that it wasn't hanging, it was just taking a long time.

表明它没有挂,只是花了很长时间。

回答by djechlin

You probably just need to update your RVM.

您可能只需要更新您的 RVM。

Note that it's not really hanging so much as it's just taking 3 minutes to tell you whoops! Should have used sudo.

请注意,它并没有真正挂起,因为它只需要 3 分钟就告诉您哎呀!应该使用sudo。

From this blog postthis on command line works:

this blog postthis on command line works:

curl -L https://get.rvm.io | bash -s stable --ruby

回答by Emanuel Ilyayev

I also experienced this issue. After installing ri1.8, it started to work properly (I use Ubuntu 10.04):

我也遇到过这个问题。安装 ri1.8 后,它开始正常工作(我使用的是 Ubuntu 10.04):

sudo apt-get -y install ri1.8

回答by Greg Eremeev

Reason of slow working is convert RDoc into HTML during installation. Just disable it via --no-rdoc --no-ri options.

运行缓慢的原因是在安装过程中将 RDoc 转换为 HTML。只需通过 --no-rdoc --no-ri 选项禁用它。

gem install your_gem --no-rdoc --no-ri

回答by Stacker-flow

If it is really slow, check your network settings - especially if using a VM

如果它真的很慢,请检查您的网络设置 - 特别是如果使用虚拟机