ruby Gem 安装无限期挂起

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

Gem install hangs indefinitely

rubygeminstallrvm

提问by rvazquez

Background: I'm a designer that works well with HTML, CSS, and JS. But when it comes to setting up my environment is where I fall short.

背景:我是一名擅长 HTML、CSS 和 JS 的设计师。但是,在设置环境方面,我有不足之处。

I recently purchased a home computer. I want to set up Middlemanto use in a project. I already installed rvm and all its requirements. I am on ruby-2.0.0-p0, which from what I understand is the latest stable release.

我最近买了一台家用电脑。我想设置Middleman以在项目中使用。我已经安装了 rvm 及其所有要求。我在 ruby​​-2.0.0-p0 上,据我所知,这是最新的稳定版本。

When I attempt to install Middleman, or any other gem for that matter, nothing happens. The cursor just moves to the next line. Screenshot

当我尝试安装 Middleman 或任何其他 gem 时,没有任何反应。光标只是移动到下一行。截屏

Some guidance, or troubleshooting steps, would be greatly appreciated!

一些指导或故障排除步骤,将不胜感激!

Thank you,

谢谢,

Ricardo

里卡多

回答by Jeff Ward

If gem installis hanging, it's most likely a network, proxy, or firewall issue on your end.

如果gem install挂起,则很可能是您的网络、代理或防火墙问题。

You can investigate by issuing your gem install command in verbose mode with -V. It'll show you what URLs it's communicating with to download the gem, and you can hopefully see what it's doing and where it's hanging:

您可以通过在详细模式下使用-V. 它会向您显示它正在与哪些 URL 进行通信以下载 gem,您希望能够看到它在做什么以及它挂在哪里:

> gem install -V middleman
HEAD https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
...

You can also check status.rubygems.orgwhere they'll alert you in case the gem/spec servers do have problems (see screenshot below):

您还可以查看status.rubygems.org,如果 gem/spec 服务器确实有问题,他们会在那里提醒您(请参见下面的屏幕截图):

RubyGem.org status screenshot

RubyGem.org 状态截图

回答by rvazquez

Found my problem! I was runnning ruby 1.8.7. I needed to update my .zshrc file to use 1.9.3 as default.

发现我的问题!我正在运行 ruby​​ 1.8.7。我需要更新我的 .zshrc 文件以使用 1.9.3 作为默认版本。

What I did was put this on my .zshrc file:

我所做的是把它放在我的 .zshrc 文件中:

rvm use 1.9.3 --default

回答by Aleksei Matiushkin

You seem to be on Mac. Have you Xcodeinstalled?

你似乎在Mac 上。你Xcode安装了吗?

The cite from MiddleManofficial:

MiddleMan官方引用:

Mac OS X comes prepackaged with both Ruby and Rubygems, however, some of the Middleman's dependencies need to be compiled during installation and on OS X that requires Xcode. Xcode can be installed via the Mac App Store. Alternately, if you have a free Apple Developer account, you can just install Command Line Tools for Xcode from their downloads page.

Mac OS X 预装了 Ruby 和 Rubygems,但是,一些 Middleman 的依赖项需要在安装过程中进行编译,并且需要在需要 Xcode 的 OS X 上进行编译。Xcode 可以通过Mac App Store安装。或者,如果您有免费的 Apple Developer 帐户,则只需从他们的下载页面安装适用于 Xcode 的命令行工具即可。

BTW, just out of curiousity, is your connection OK? Try to run ping google.comin the sibling terminal during gem install ….

顺便说一句,出于好奇,您的连接正常吗?期间尝试ping google.com在同级终端中运行gem install …