安装kgio宝石时出现错误

7

我下载了一个Rails开源Web应用程序,当我使用以下方式启动它时:

C:\Users\admin\Downloads\iCare\icare-develop>rails server
←[31mCould not find kgio-2.8.0 in any of the sources←[0m
←[33mRun `bundle install` to install missing gems.←[0m

我试图使用以下方法修复这个错误:

cmd:>gem install kgio -v '2.8.0'

我得到了一个错误:
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing kgio:
ERROR: Failed to build gem native extension.C:/Ruby193/bin/ruby.exe extconf.rb
checking for CLOCK_MONOTONIC in time.h... no
checking for CLOCK_MONOTONIC() in time.h... no
checking for clockid_t in time.h... no
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:/Ruby193/bin/ruby
        --with-rtlib
        --without-rtlib
        --with-nsllib
        --without-nsllib
        --with-socketlib
        --without-socketlib

同时 Gem 文件将保留在 C:/Ruby193/lib/ruby/gems/1.9.1/gems/kgio-2.8. 0 中,以供检查。 结果记录在 C:/Ruby193/lib/ruby/gems/1.9.1/gems/kgio-2.8.0/ext/kgio/gem_ma ke.out 中。

我输入了 bundle install 命令,但没有任何反应。


我在代码段之间添加了这些“and”,因为我无法提交我的问题。 - Br3x
3个回答

14

kgio 只适用于 *nix系统。

kgio gem页面:

kgio 2.8.0 提供非阻塞I/O方法,可在Ruby中使用,而不会在EAGAIN和EINPROGRESS上引发异常。它旨在与Unicorn和Rainbows! Rack服务器一起使用,但也可以被其他应用程序所使用(在类Unix平台上运行)。


你是对的;我在虚拟安装的Ubuntu上尝试了一下,它能够工作! - Br3x
所以我们知道这是针对类Unix平台的...那有什么帮助呢?如果我不想虚拟安装Ubuntu,我该如何做到让这个gem不安装/不需要呢? - user1318135
1
如果您需要在最终应用程序中使用Unicorn(或类似的工具),而不是用于开发,请尝试将以下内容添加到您的Gemfile文件中:group :production, :test do gem 'unicorn' end - joaoprib
如果你在Windows机器上运行,仅添加组是不够的。请按照这里的提示(https://dev59.com/yWgv5IYBdhLWcg3wNuJ5#10764443),使用以下代码:'platforms :ruby do # linux gem 'unicorn' endplatforms :mswin do

gems specific to windows

end'
- MrWater

3

0

我觉得你在使用Windows操作系统,所以解决这个错误的唯一方法就是在你的gem文件中注释掉或删除gem 'unicorn',因为它只适用于Linux系统。


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