2016-10-27 74 views
0

当我运行“包安装”在我的项目目录,我得到以下错误时:“无法建立宝石原生扩展”运行包安装

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

    c:/Ruby22/bin/ruby.exe -r ./siteconf20161028-11856-1tljde.rb extconf.rb 
checking for CLOCK_MONOTONIC in time.h... yes 
checking for clockid_t in time.h... yes 
checking for clock_gettime() in -lrt... no 
checking for t_open() in -lnsl... no 
checking for socket() in -lsocket... no 
checking for poll() in poll.h... no 
checking for getaddrinfo() in sys/types.h,sys/socket.h,netdb.h... no 
getaddrinfo required 
*** 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:/Ruby22/bin/$(RUBY_BASE_NAME) 
     --with-rtlib 
     --without-rtlib 
     --with-nsllib 
     --without-nsllib 
     --with-socketlib 
     --without-socketlib 

extconf failed, exit code 1 

Gem files will remain installed in c:/Ruby22/lib/ruby/gems/2.2.0/gems/kgio-2.9.2 
for inspection. 
Results logged to 
c:/Ruby22/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/kgio-2.9.2/gem_make.out 

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

这里是我的Gemfile:

source 'https://rubygems.org' 

#don't upgrade 
gem 'rails', '3.2.11' 
gem 'rack', '1.4.0' 

ruby '2.2.5' 


gem 'rack-attack' 
# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'sqlite3' 
gem 'foreman' 

group :development do 
    gem 'brakeman' 
    gem 'bundler-audit' 
    gem 'guard-brakeman' 
    gem 'guard-livereload' 
    gem 'guard-rspec' 
    gem 'guard-shell' 
    gem 'pry' 
    gem 'rack-livereload' 
    gem 'rb-fsevent' 
    gem 'travis-lint' 
    gem 'better_errors' 
    gem 'binding_of_caller' 
end 

gem 'gauntlt' 

gem 'simplecov', :require => false, :group => :test 

group :development, :test do 
    gem 'launchy' 
    gem 'capybara' 
    gem 'database_cleaner' 
    gem 'poltergeist' 
    gem 'rspec-rails', '2.14.2' 
end 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails' 
    gem 'coffee-rails' 
    gem 'jquery-fileupload-rails' 
    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    # gem 'therubyracer', :platforms => :ruby 

    gem 'uglifier' 
end 

gem 'jquery-rails' 

# To use ActiveModel has_secure_password 
gem 'bcrypt' 

# To use Jbuilder templates for JSON 
# gem 'jbuilder' 

# Use unicorn as the app server 
gem 'unicorn' 

# Pow related gem 
gem 'powder' 

gem 'aruba' 
#gem 'minitest', '~> 4.0', :require=> "minitest/autorun" 

#gem 'minitest' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'debugger' 

gem 'execjs' 
gem 'therubyracer' 

# Add SMTP server support using MailCatcher 
gem 'mailcatcher' 

我在Windows 10上运行ruby 2.2.5 我不确定rails版本是由于我在尝试'rails -v'时出现错误。我不认为这是我面临上述错误的原因,因为'rails -v'错误是最近的事情。

回答

0

你的Gemfile中有gem 'unicorn'吗?

独角兽需要kgio未能安装,我不确定这个gem在Window上工作。尝试将服务器从unicorn更改为thin - 开发没关系。你

还可以指定宝石的平台,在您的Gemfile

platforms :ruby do #unux 
    gem 'unicorn' 
end 

platforms :mswin do 
    #gems specific to windows 
end 

希望它可以帮助

+0

感谢您的答复。我会尝试从独角兽变成稀薄的。然而,有可能向我解释更多(通俗地说,也许?)答案的第二部分?我仍然是一个非常新的编码,并且我已经遇到了麻烦,只需设置**即可开始。 –

+0

在Gemfile中,您可以指定为不同平台安装的宝石。如果我在答案中显示**,gem unicorn **将在您在UNIX系统(如ubuntu或MacOS)上运行应用程序时安装。当您在Windows平台上运行软件包和应用程序时,将会安装':mswin'块中的宝石。您可以在这里阅读关于群组的信息:[bundler groups doc](http://bundler.io/groups.html)和[bundler gemfile groups](http://bundler.io/man/gemfile.5.html#团体) – idej

+0

好吧,我明白了。另一个noob问题:为什么我不能找到我的gemfile中的mswin块?或者你的意思是我应该自己添加它? –

相关问题