V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
spark
V2EX  ›  Ruby on Rails

在Lion下搭建Rails环境遇挫, 求救!

  •  
  •   spark · 2011-10-04 17:57:30 +08:00 · 6263 次点击
    这是一个创建于 4831 天前的主题,其中的信息可能已经有所发展或是发生改变。
    http://ruby.railstutorial.org/

    还是按照书中内容全新安装git, rvm, 用rvm安装ruby 1.9.2, 都正常.

    奇怪的问题来了, gem install rails 死活也安装不上, google了很多方法都不能解决.

    gem install rails --debug

    <pre>
    Exception `NameError' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:177 - uninitialized constant Gem::Commands::InstallCommand
    Exception `Gem::LoadError' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247 - Could not find psych (>= 1.2.1, ~> 1.2) amongst []
    Exception `OptionParser::MissingArgument' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:458 - missing argument:
    Exception `OptionParser::MissingArgument' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:1311 - missing argument: -i
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EAGAIN' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
    Exception `Errno::EEXIST' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:243 - File exists - /Users/username/.gem/specs/gems.github.com%80
    Exception `Gem::GemNotFoundException' at /Users/username/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:237 - Could not find a valid gem 'rails' (>= 0) locally or in a repository
    ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
    </pre>
    25 条回复    1970-01-01 08:00:00 +08:00
    daqing
        1
    daqing  
       2011-10-04 18:07:51 +08:00
    安装一下psych: gem install psych
    AntiGameZ
        2
    AntiGameZ  
       2011-10-04 18:13:57 +08:00
    说白了还是gfw作祟
    spark
        3
    spark  
    OP
       2011-10-04 18:14:18 +08:00
    感谢楼上的回复,psych安装也出现类似上边的错误。
    spark
        4
    spark  
    OP
       2011-10-04 18:16:08 +08:00
    @AntiGameZ 我看了李华顺的文章,可能是你说的问题导致.
    http://huacnlee.com/blog/using-nginx-proxy-to-mirror-rubygem-org

    想请问有没有什么解决方案呢?实在不想把假期浪费掉啊
    AntiGameZ
        5
    AntiGameZ  
       2011-10-04 18:20:43 +08:00
    @spark 不用李华顺的方案的话,两条路,自己搭建一个gems(李在文章里也说到了);或者去rubygems网站上,把要用的都给下下来。

    不过自己想了下,似乎可以通过改hosts的方式绕开gfw,但是目前没力气去尝试。
    Livid
        6
    Livid  
    MOD
       2011-10-04 18:30:07 +08:00
    rubygems.org 上是否存在什么特别敏感的东西么?

    如果不存在的话,我倒是可以为它搭建一个反向代理并且在 V2EX DNS 上做一些特殊设置,这样只要使用 V2EX DNS 即可正常安装 gems 了。
    Livid
        7
    Livid  
    MOD
       2011-10-04 18:32:46 +08:00
    不知为什么 @huacnlee 之前提供的 184.82.37.134 现在无法访问了呢?
    AntiGameZ
        8
    AntiGameZ  
       2011-10-04 18:38:34 +08:00
    @Livid 干吧,我带头第一个用
    spark
        9
    spark  
    OP
       2011-10-04 18:53:40 +08:00
    @Livid 华顺提供的那个ip确实是不能用了,但是确实想不通rubygems.org有什么敏感的东西。

    目前正在用最笨的办法, 手动从rubygems挨个下载gem, 唉
    pepsin
        10
    pepsin  
       2011-10-04 19:06:07 +08:00
    @spark rubygem用的好像是amazon的服务器,被墙了一些,今天专门买了个vpn解决了这问题。郁闷啊
    Livid
        11
    Livid  
    MOD
       2011-10-04 19:09:19 +08:00
    嗯,加入 Todo 列表。今晚看完 Apple 发布会后试验。
    jeuxee
        12
    jeuxee  
       2011-10-04 19:54:07 +08:00 via iPad
    我也遇到过问题,不过不是这种提示,也没用rvm。我的问题是Lion默认用LLVM替换了GCC引起的,安装时指定用GCC 4.3就顺利了。
    Andor_Chen
        13
    Andor_Chen  
       2011-10-04 20:28:16 +08:00
    @livid 强烈支持

    每次安装 gem 都要挂 VPN 有点不爽
    cngithub
        14
    cngithub  
       2011-10-04 20:30:58 +08:00
    是gfw的问题。昨晚用家里的宽带,连rvm install 1.9.2都无法执行,提示找不到文件。换了vpn,没问题了。
    huacnlee
        15
    huacnlee  
       2011-10-05 10:22:27 +08:00
    @Livid 那个服务挂了...找不会来了,打家可以直接搞个跳板, 参见:
    http://huacnlee.com/blog/using-nginx-proxy-to-mirror-rubygem-org
    spark
        16
    spark  
    OP
       2011-10-05 11:22:12 +08:00 via iPad
    @cngithub @Andor_Chen 我尝试挂vpn也不行

    期待@Livid的实验结果^_^
    pepsin
        17
    pepsin  
       2011-10-08 15:44:21 +08:00
    rvm install 1.9.2 碰上 “There has been an error while trying to fetch the source” ,有人知道怎么解决么?Vpn 我们这也挂不上了。。。
    roamlog
        18
    roamlog  
       2011-10-09 09:07:58 +08:00
    不知道 @livid 有没实验成功?
    linsk
        19
    linsk  
       2011-10-09 10:13:39 +08:00
    注意你的gem版本,前阵子我装的时候1.8.6和最新的1.8.8均出错~最后用了1.8.7解决问题。
    flyingkid
        20
    flyingkid  
       2011-10-15 11:49:50 +08:00
    搞个vpn,或者自己把rails下回来,本地装。
    我建议弄个vpn。
    弄到本地来弄太折腾了。
    而且我发现install rails完全比人品的。
    我之前用v2ex dns成功安装过一次,后来升级到lion以后就在也没有成功了。
    我最后用vpn搞定了,几分钟就解决问题了。法克法克。。。
    victor
        21
    victor  
       2011-10-31 06:55:32 +08:00
    我覺得樓上說的是最好的辦法,VPN的價格一般在10元/月以內,除了安裝Gem方便,搭配Firefox的AutoProxy去Google查資料也方便。

    能花幾塊錢解決的問題,就不要浪費時間自己折騰了。:)
    stranbird
        22
    stranbird  
       2011-10-31 09:44:01 +08:00
    楼主应该已经装好了..

    但是还是说一下,仿佛装1.9.2之前必须装1.8.7的。
    spark
        23
    spark  
    OP
       2011-10-31 11:49:09 +08:00
    确实早已装好,VPN和SSH都买了,结果发现和网络的关系不大。

    解决方案是用rvm把该装的pkg都安装上,然后重新编译安装1.9.2
    Readline
    IConv
    Zlib
    OpenSSL
    Autoconf
    spark
        24
    spark  
    OP
       2011-10-31 11:51:49 +08:00
    补充一点,我发这个贴子时的出错原因貌似是因为没有安装readline和openssl。

    @stranbird 提到的这点确实是很多用rvm的新手可能会很头痛的问题。
    marco
        25
    marco  
       2011-10-31 12:01:01 +08:00
    永远都在 VPN 的保护下,从来没遇到过问题。记得要开启所有流量走 VPN 。

    大家如果嫌 VPN 状态下连国内服务器慢,就用 http://code.google.com/p/chnroutes/ 把连接国内服务器设置走本地就好。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3054 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 13:31 · PVG 21:31 · LAX 05:31 · JFK 08:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.