【问题标题】:Rails Installing debugger (1.5.0) throws errorRails 安装调试器(1.5.0)抛出错误
【发布时间】:2013-08-08 10:36:05
【问题描述】:

我正在尝试为 Rails 项目执行“捆绑安装”。 但我被打动了

Installing debugger (1.5.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.

        c:/jruby-1.7.4/bin/jruby.exe extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=tru
e to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

   (root) at c:/jruby-1.7.4/lib/ruby/shared/mkmf.rb:8
  require at org/jruby/RubyKernel.java:1054
   (root) at c:/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:1
   (root) at extconf.rb:15


Gem files will remain installed in c:/jruby-1.7.4/lib/ruby/gems/shared/gems/debu
gger-1.5.0 for inspection.
Results logged to c:/jruby-1.7.4/lib/ruby/gems/shared/gems/debugger-1.5.0/ext/ru
by_debug/gem_make.out
An error occurred while installing debugger (1.5.0), and Bundler cannot
continue.
Make sure that `gem install debugger -v '1.5.0'` succeeds before bundling.

然后我尝试了

$ gem install debugger -v '1.5.0'
WARNING:  RubyGems 1.2+ index not found for:


RubyGems will revert to legacy indexes degrading performance.
Updating metadata for 1 gems from http://rubygems.org/
.
complete
ERROR:  While executing gem ... (Errno::EACCES)
    Access to the path 'c:\Program Files\IronRuby 1.1\Lib\ruby\gems\1.9.1\source
_cache' is denied.

所有 gem 都已正确安装,但 gem 调试器 (1.5.0) 的 gem 安装停止

我的 gem 环境是:

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i386-mswin32]
  - INSTALLATION DIRECTORY: c:/Program Files/IronRuby 1.1/Lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: "c:/Program Files/IronRuby 1.1/bin/ir.exe"
  - EXECUTABLE DIRECTORY: c:/Program Files/IronRuby 1.1/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-dotnet-4.0
  - GEM PATHS:
     - c:/Program Files/IronRuby 1.1/Lib/ruby/gems/1.9.1
     - c:/Users/swapnil/.gem/ironruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

提前致谢。

【问题讨论】:

  • 如果您使用的是 RVM 并且来源不正确,则可能会发生这种情况。

标签: ruby-on-rails ruby rubygems bundler


【解决方案1】:
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

这似乎是你的问题,所以只需启用 JRuby 的 C 扩展支持,看看是否有效!

【讨论】:

    【解决方案2】:

    您使用的是JRuby 还是IronRubydebugger 不适用于 JRuby(请参阅 here),但我从未尝试使用 IronRuby

    【讨论】:

      【解决方案3】:

      调试器 gem 仅用于 CRuby (MRI)。如果您使用不同的 Ruby 实现,则需要使用该平台的原生调试器。

      This blog post Chris Gaffney 解释了如何基于 Ruby 平台有条件地包含不同的调试 gem。

      【讨论】:

      • 你确定吗?我想说debugger 也适用于 Windows 平台。
      • 如果您使用 MRI,它可以在 Windows 上运行。我在回答中所说的“平台”是指 Ruby 解释器的类型,而不是操作系统。 JRuby 和 IronRuby 使用完全不同的运行时环境(JVM 和 CLR),因此它们需要不同的调试器。
      • 我的意思也是 ruby​​ 解释器。使用链接中提到的bundler:platform 术语,我想说至少mri_19mingw_19 得到debugger 的支持,还有an open issue 带来jruby 的支持。但是,是的,看起来 JRubyIronRuby 现在都不能与 debugger 一起使用。
      【解决方案4】:

      如果您使用的是 RVM 并且来源不正确,则可能会发生这种情况。

      user$ source ~/.rvm/scripts/rvm
      

      并确保以下命令返回“rvm is a function”

      user$ type rvm | head -n 1
      rvm is a function
      

      【讨论】:

        猜你喜欢
        • 2016-07-08
        • 1970-01-01
        • 2018-06-30
        • 1970-01-01
        • 1970-01-01
        • 2014-05-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多