Gem Debugger 无法通过 bundle install 进行安装

Gem Debugger 无法通过 bundle install 进行安装

我已经使用 rvm 安装了 ruby​​ on rails。我使用的是 2.2.0 ruby​​ 和 4.2.0 Rails。我尝试在以前的 PC 上开发的旧项目上运行 bundle install,但我得到了:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/florin/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20151003-6297-foug8b.rb extconf.rb
*** 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=/home/florin/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
/home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:1391:in `initialize': No such file or directory @ rb_sysopen - ./223/ruby_debug.h (Errno::ENOENT)
    from /home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:1391:in `open'
    from /home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:1391:in `copy_file'
    from /home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:485:in `copy_file'
    from /home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:402:in `block in cp'
    from /home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:1570:in `block in fu_each_src_dest'
    from /home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:1584:in `fu_each_src_dest0'
    from /home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:1568:in `fu_each_src_dest'
    from /home/florin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:401:in `cp'
    from extconf.rb:83:in `block in <main>'
    from extconf.rb:82:in `each'
    from extconf.rb:82:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /home/florin/.rvm/gems/ruby-2.2.3/gems/debugger-1.6.8 for inspection.
Results logged to /home/florin/.rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/debugger-1.6.8/gem_make.out
An error occurred while installing debugger (1.6.8), and Bundler cannot
continue.
Make sure that `gem install debugger -v '1.6.8'` succeeds before bundling.

通过阅读互联网,我尝试安装所有开发工具,例如:sudo apt-get install libpq-dev

sudo apt-get install libmysqlclient-dev
sudo apt-get install libpq-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install libev-dev

但它不起作用。

答案1

当我从 ruby​​-1.9.3-p385 升级到 ruby​​-2.2.3 时也发生了同样的事情。

看起来当你生成项目时,Rails 会使用适合 Ruby 版本的 gem,但不能保证它们也适用于其他 Ruby 版本。

在这种情况下,调试器不支持 Ruby 2.1.1 以上版本,您可以通过以下方式替换:

gem 'debugger'

和:

gem 'byebug'

在你的 Gemfile 中。

相关内容