【问题标题】:Ruby on Rails - linecache error while trying to ' bundle install 'Ruby on Rails - 尝试“捆绑安装”时出现线路缓​​存错误
【发布时间】:2011-04-22 10:25:00
【问题描述】:

您好,我正在尝试在我的 Windows 机器上运行 bundle install,它运行良好,直到它到达 linecache,然后吐出一个巨大的错误:

Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.2)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.26)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.17)
Using actionmailer (3.0.3)
Using arel (2.0.9)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.12)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using render_component_vho (3.0.3)
Using verification (1.0.1)
Using active_scaffold_vho (3.0.19)
Using columnize (0.3.2)
Installing linecache (0.43) with native extensions C:/Ruby192/lib/ruby/site_ruby
/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR
: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        C:/Ruby192/bin/ruby.exe extconf.rb
Can't handle 1.9.x yet
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby192/bin/ruby


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/linecache
-0.43 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/linecache-0.43/ext/gem_mak
e.out
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `b
lock in build_extensions'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `e
ach'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `b
uild_extensions'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `i
nstall'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/sour
ce.rb:96:in `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/inst
aller.rb:55:in `block in run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec
_set.rb:12:in `block in each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec
_set.rb:12:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec
_set.rb:12:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/inst
aller.rb:44:in `run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/inst
aller.rb:8:in `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/cli.
rb:225:in `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vend
or/thor/task.rb:22:in `run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vend
or/thor/invocation.rb:118:in `invoke_task'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vend
or/thor.rb:246:in `dispatch'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vend
or/thor/base.rb:389:in `start'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/bin/bundle:13:in
 `<top (required)>'
        from C:/Ruby192/bin/bundle:19:in `load'
        from C:/Ruby192/bin/bundle:19:in `<main>'

我尝试在谷歌上搜索该问题,并找到了两个解释我首先遇到的问题的帖子是 Stackoveflow Post,这与我所得到的非常接近,但经过进一步检查,我发现给出的解决方案那篇文章不是我需要的 另一个是this post,它似乎在讨论我遇到的确切问题,但没有给出解决方案,有人知道我应该怎么做吗??

Ruby 版本 => 1.9.2

Rails 版本 => 哦,来吧,它甚至不告诉 rails 版本它只是打印出另一个错误

Could not find linecache-0.43 in any of the sources
Try running `bundle install`.

任何想法我做错了什么?任何帮助将不胜感激

【问题讨论】:

    标签: ruby-on-rails-3 linecache


    【解决方案1】:

    您应该尝试安装linecache19 而不是linecache。您尝试安装的 gem 与 Ruby 版本 1.9.2 不兼容。

    错误信息也提示了这一点:

    Can't handle 1.9.x yet
    

    【讨论】:

    • 是的,谢谢你的建议,
    • 如果你使用 ruby​​-debug(依赖 linecache)和 ruby​​1.9.x(依赖 linecache19),仅仅 linecache19 没有帮助。您需要将 ruby​​-debug 切换到 ruby​​-debug19。
    • @ramonrails 这是一年多之后,但我爱你!非常感谢您发表评论!
    • 尝试“调试器”以获得更流畅的体验和更少的捆绑麻烦
    • 对于 Ruby 版本 > 2,使用 byebug 作为suggested here
    【解决方案2】:

    “调试器” gems 最近对我来说更加完美。 我从 ruby​​-debug19 切换到调试器,它可以轻松安装依赖项。

    【讨论】:

      【解决方案3】:

      1.9.2-p136 + RVM。使用安装 linecache19 作为依赖项的 ruby​​-debug19 工作:

      gem install ruby​​-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p136/

      【讨论】:

      • 应该同时安装 linechache19 和 ruby​​-debug19
      • 这帮助我解决了尝试离线安装的问题。尝试从 ftp ruby​​lang 检索时,Make 在 linecache 上中断,这解决了这个问题 - 谢谢!
      最近更新 更多