2016-10-27 110 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塊?或者你的意思是我應該自己添加它? –

相關問題