【问题标题】:Error with ruby bundle install红宝石捆绑安装错误
【发布时间】:2017-06-03 23:57:26
【问题描述】:

当我尝试运行 bundle install 时,我看到:

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/extensions/x86-
mingw32/2.3.0/nio4r-2.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/nio4r-2.1.0 for 
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/extensions/x86-
mingw32/2.3.0/nio4r-2.1.0/gem_make.out

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

我使用的是 Windows 10、Ruby 2.3.3、Rails 5.0.2。

mkmf.log内容是:

"gcc -o conftest.exe -IC:/RailsInstaller/Ruby2.3.0/include/ruby-2.3.0/i386-
mingw32 -IC:/RailsInstaller/Ruby2.3.0/include/ruby-2.3.0/ruby/backward -
IC:/RailsInstaller/Ruby2.3.0/include/ruby-2.3.0 -I. -DFD_SETSIZE=2048 -
D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -
O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-
parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -
Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-
statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-
packed-bitfield-compat conftest.c  -L. -LC:/RailsInstaller/Ruby2.3.0/lib -L.      
-lmsvcrt-ruby230  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "

检查的程序是:

#include "ruby.h"

#include <winsock2.h>
#include <windows.h>
int main(int argc, char **argv)
{
  return 0;
}

【问题讨论】:

  • 运行gem install nio4r -v '2.1.0'也显示错误?
  • 如果在发布问题时提供尽可能多的信息,我们会为您提供帮助,您的 mkmf.log 文件的内容是什么,应该提供有关错误的一些信息
  • 是的,我正在运行 gem install nio4r -v '2.1.0' 并显示同样的错误
  • 提供mkmf.log的内容会很有帮助,位于C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/extensions/x86- mingw32/2.3.0/nio4r-2.1.0/

标签: ruby ruby-c-extension


【解决方案1】:

如果其他 gem 有相同的错误(并且是初始的 bundle install),请尝试将 gemfile 中的 source 'https://rubygems.org' 更改为 source 'http://rubygems.org'

我在公司网络中的 Windows 上遇到了这个问题,并且在 ssl 的某个地方出现了问题。该解决方案对我有用,但我知道,它不是最佳解决方案。

但如果任何其他 gem 安装成功,这是一个不好的建议。

【讨论】:

  • 我已经试过了,改成 source 'rubygems.org' not working
  • 我的意思是改成http
猜你喜欢
  • 2017-12-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-19
  • 2015-07-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多