【问题标题】:Error installing gem capybara-webkit getting the following error: Gem::Ext::BuildError: ERROR: Failed to build gem native extension安装 gem capybara-webkit 时出错,出现以下错误:Gem::Ext::BuildError: ERROR: Failed to build gem native extension
【发布时间】:2021-02-08 01:26:50
【问题描述】:

安装 gemlock 文件时出现以下错误: 我对 Ruby 很有经验,但我想做的只是从 github 运行应用程序。这是 2015 年编写的一个相当古老的程序 (https://github.com/jmopr/job-hunter)

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

current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.15.1
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20201025-18652-1a6uktj.rb
extconf.rb
Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?
*** 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:/RailsInstaller/Ruby2.3.3/bin/$(RUBY_BASE_NAME)
        --with-gl-dir
        --without-gl-dir
        --with-gl-include
        --without-gl-include=${gl-dir}/include
        --with-gl-lib
        --without-gl-lib=${gl-dir}/lib
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
Command 'qmake ' failed

extconf failed, exit code 1

Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.15.1 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/capybara-webkit-1.15.1/gem_make.out

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

In Gemfile:
  capybara-webkit

这个项目的目标是从 git hub 下载并运行 ruby​​ on rails 应用程序。这是 2015 年以来的一个较旧的应用程序,这就是我遇到如此多依赖问题的原因。以下是我的 gem 文件供进一步参考。

source 'https://rubygems.org'

#gem 'timeout'
gem 'capybara'
gem 'activerecord-reset-pk-sequence'
gem 'kaminari'
gem 'react-rails'
gem "paperclip"
gem 'dotenv-rails', :groups => [:development, :test]
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'nokogiri', '>= 1.5.0'

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'
gem 'faraday', '~> 0.9.2'
gem 'httparty', '~> 0.13.7'
gem 'delayed_job_active_record'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :test, :production do
  gem 'pg'
end

group :development, :test do
  gem 'capybara-webkit'
  gem 'selenium'
  gem 'selenium-webdriver'
  gem 'byebug'
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

``
  
    

【问题讨论】:

  • 运行gem install capybara-webkit -v '1.15.1' 看看你遇到了什么错误。有时您可以安装单个 gem。很可能您缺少错误所说的头文件。

标签: ruby-on-rails ruby ruby-on-rails-4 rubygems ruby-2.2


【解决方案1】:

很高兴知道您使用的是哪个操作系统。我可以看到它的 Windows?

在 Mac 上,您可能需要安装 qtwebkit 在 Ubuntu 上 Xvfb 可以提供帮助。 但是 IDK 如何在 windows 上处理这个问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-06
    • 1970-01-01
    • 1970-01-01
    • 2016-10-02
    • 2012-11-29
    • 2020-11-11
    • 2012-10-17
    • 2019-04-18
    相关资源
    最近更新 更多