ChatGPT解决这个技术问题 Extra ChatGPT

Ruby Gems Not Installing, Hangs While Getting Gems

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

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.

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
A bit off-topic, but you can't kill with a -9? (ie, run "ps aux | grep gem", find the pid, and then do "kill -9 pid"? Rebooting to kill a process seems harsh to me. Could there be many things wrong with your system if -9 won't work?
kill -9 got it. Thanks, I didn't know about that. I thought -0 was the nuc version, but apparently -9 is it.
is gems.rubyforge.org responding quickly from your location. I have found that if a remote server is not responding then gems can hang for a long time
Are you behind a firewall or NAT? Can you ping rubygems.org ? How about curl http://rubygems.org/specs.4.8.gz or curl http://rubygems.org/gems/rails-2.3.5.gem ?
I was able to install gems fine (and quickly) from a linux machine behind the same router.

L
Leopd

For me

sudo gem install rails -V

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


Upvoted. While I'm still not convinced something else isn't wrong (it seems to be taking an unaccountably long time to do simple HTTP gets), the -V tells me something is happening. Thanks for the suggestion.
Looks like I was running into the same issue.
And what if I've been waiting for one hour and all I see is: 'xStation> gem install rails -v 3.2.0 -V GET 301 Moved Permanently: gems.rubyforge.org/specs.4.8.gz GET 302 Moved Temporarily: rubygems.org/specs.4.8.gz GET 200 OK: s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz'
Perhaps it should be verbose by default?
Apparently, Ruby is still terribly slow.
d
djechlin

You probably just need to update your 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.

From this blog post this on command line works:

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

E
Emanuel Ilyayev

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

sudo apt-get -y install ri1.8

G
Greg Eremeev

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

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

S
Stacker-flow

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


关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now