无法安装 Debugger gem - Rails - Mac OSX Mavericks

7

我试图在本地运行一个应用程序,但是当我这样做时,就会出现以下错误。

Patricks-MacBook-Air:niet pbj$ rails s
Could not find debugger-1.6.1 in any of the sources
Run `bundle install` to install missing gems.

当我运行 'bundle install' 命令时,出现以下信息:
Fetching source index from https://rubygems.org/
Enter your password to install the bundled RubyGems to your system: 
Using rake (10.1.0) 
Using i18n (0.6.5) 
Using minitest (4.7.5) 
Using multi_json (1.8.0) 
Using atomic (1.1.13) 
Using thread_safe (0.1.3) 
Using tzinfo (0.3.37) 
Using activesupport (4.0.0) 
Using builder (3.1.4) 
Using erubis (2.7.0) 
Using rack (1.5.2) 
Using rack-test (0.6.2) 
Using actionpack (4.0.0) 
Using mime-types (1.25) 
Using polyglot (0.3.3) 
Using treetop (1.4.15) 
Using mail (2.5.4) 
Using actionmailer (4.0.0) 
Using activemodel (4.0.0) 
Using activerecord-deprecated_finders (1.0.3) 
Using arel (4.0.0) 
Using activerecord (4.0.0) 
Using addressable (2.3.5) 
Using json (1.8.0) 
Using mini_portile (0.5.1) 
Using nokogiri (1.6.0) 
Using uuidtools (2.1.4) 
Using aws-sdk (1.11.1) 
Using bcrypt-ruby (3.1.1) 
Using coderay (1.0.9) 
Using better_errors (0.9.0) 
Using debug_inspector (0.0.2) 
Using binding_of_caller (0.7.2) 
Using sass (3.2.10) 
Using thor (0.18.1) 
Using bourbon (3.1.8) 
Using callsite (0.0.11) 
Using cancan (1.6.10) from https://github.com/ricec/cancan.git (at master) 
Using xpath (2.0.0) 
Using capybara (2.1.0) 
Using climate_control (0.0.3) 
Using cocaine (0.5.1) 
Using columnize (0.3.6) 
Using database_cleaner (1.1.1) 
Using debugger-linecache (1.2.0) 
Using debugger-ruby_core_source (1.2.3) 
Installing debugger (1.6.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... yes
checking for vm_core.h... yes
checking for iseq.h... no
Makefile creation failed
*************************************************************

  NOTE: If your headers were not found, try passing
        --with-ruby-include=PATH_TO_HEADERS      

*************************************************************

*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-ruby-dir
    --without-ruby-dir
    --with-ruby-include
    --without-ruby-include=${ruby-dir}/include
    --with-ruby-lib
    --without-ruby-lib=${ruby-dir}/


Gem files will remain installed in /Users/pbj/.bundler/tmp/39109/gems/debugger-1.6.1 for inspection.
Results logged to /Users/pbj/.bundler/tmp/39109/gems/debugger-1.6.1/ext/ruby_debug/gem_make.out

An error occurred while installing debugger (1.6.1), and Bundler cannot
continue.
Make sure that `gem install debugger -v '1.6.1'` succeeds before bundling.

安装调试器宝石时,出现以下错误:
Building native extensions.  This could take a while...
ERROR:  Error installing debugger:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... yes
checking for vm_core.h... yes
checking for iseq.h... no
Makefile creation failed
*************************************************************

  NOTE: If your headers were not found, try passing
        --with-ruby-include=PATH_TO_HEADERS      

*************************************************************

*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-ruby-dir
    --without-ruby-dir
    --with-ruby-include
    --without-ruby-include=${ruby-dir}/include
    --with-ruby-lib
    --without-ruby-lib=${ruby-dir}/


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/debugger-1.6.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/debugger-1.6.2/ext/ruby_debug/gem_make.out

目前,我完全不知道如何解决这个问题。


请尝试在您的Gemfile中添加gem 'debugger'。 - LHH
我该怎么做呢?抱歉,我对这整个东西都很陌生。 - patrick
4
调试器在 Mavericks 上默认的 Ruby 2.0 中无法使用。您应该安装 byebug 或 RubyMine 来代替使用。 - frandroid
遇到了同样的问题,进行了一些挖掘并找到了这个链接 - http://levimccallum.com/post/64893573116/compiling-ruby-debugger-gem-on-mac-os-x-10-9-mavericks 但是建议的命令返回一个错误,说所选软件无法从下载服务器获取。希望这能帮助某人更进一步。 - Angelo Genovese
4个回答

6

这是XCode 5.1的问题。请尝试以下操作:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GEMNAME

然后,您就可以成功安装它了。

谢谢你。太棒了! - Chris M

3

请确保您使用正确的Ruby版本,可以通过命令"ruby -v"查看。如果您使用的是RVM,请确保切换到正确的版本,可以使用命令"rvm use 2.0"。否则,请提供有关您当前使用的Ruby和Rails版本以及是否使用RVM或系统Ruby等更多信息。


0
Mavericks 的默认 Ruby2.0 头文件位置错误。尝试安装您自己的 Ruby,可以手动安装或通过版本管理器(如 rbenv)安装,并再次运行。

您可以通过运行来检查

which ruby

如果输出为

/usr/bin/ruby

那么它可能正在使用系统自带的 Ruby


0

我知道这不太好看。我知道它会感觉很脏。我不喜欢下载我不会使用的 gem。但这对我有用。

我在两台不同的机器上以及我的机器上都遇到了相同的问题,即使用 bundler 尝试获取 debugger 1.6.0 和 ruby 1.7.3(以及其他一些 gem)时出现问题。它拒绝下载,手动下载也不起作用。我尝试安装其他版本来解决问题,最终找到了一个解决方法(我不知道为什么它有效),即运行“bundle update”,然后运行“git checkout .”以还原 gemlock 文件,最后运行“bundle install”。这个方法每次都有效。

这只是一个猜测,但我认为“bundle install”会对要下载的 gem 列表进行排序,并停在第一个抛出错误的 gem 上,因此后续依赖项不会下载。当运行“bundle update”时,它会遍历列表并获取最新版本,因此如果出现错误,则会报告错误。因此,如果 gem 中存在某种类型的循环依赖关系,则可以通过获取依赖项或导致问题的可行版本来解决该问题。我找不到证明这甚至是可能的

类似问题: 捆绑安装循环依赖关系


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接