新手问题 在 Windows 环境下安装 unicorn gem 包出错

mumu · November 23, 2015 · Last by marksloan replied at November 25, 2015 · 3561 hits
gem install unicorn 

出现错误如下: Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing unicorn: ERROR: Failed to build gem native extension.

D:/RailsInstaller/Ruby2.1.0/bin/ruby.exe 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=D:/RailsInstaller/Ruby2.1.0/bin/ruby --with-rtlib --without-rtlib --with-nsllib --without-nsllib --with-socketlib --without-socketlib

extconf failed, exit code 1

Gem files will remain installed in D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/kgio-2.10.0 for inspection. Results logged to D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/kgio-2.10.0/gem_make.out

请问是什么原因呢?

错误日志贴全。

可能是由于 win 和 Linux 的编译器不太一样吧。

take  advantage of features in Unix/Unix-like kernels.

也许作者根本没打算兼容 win。

必须出错啊。。。这个 gem 没法在 win 下装,用 jruby 在任何环境下也没法装这个 gem 可以换成 puma 用用,这个在 win 下还是可以编译通过的

windows 下还是用 vagrant 吧,不折腾

Win 下可用 thin

Windows 推荐 puma,unicorn 从来就是不支持的。

论坛里已经有人分享了:Windows 使用 Vargrant 搭建 Ruby on Rails 开发环境

https://ruby-china.org/topics/28141

楼主把折腾环境的时间省出来可以多学点有用的知识。 😄

新版 Vargrant 的共享文件夹同步速度慢到爆直接推荐在 win 下开发

win 下用不了 Unicorn,应该是这样

远离 windows 才是正道

#5 楼 @ruchee 启用服务

thin start

提示“warning: epoll is not supported on this platform”

#11 楼 @mumu 别慌,只是 warning。不过还是推荐 puma。

比较稀缺的是部署到 windows server 的最佳实践,毕竟很多企业内网应用对 windows 的感情还是很深的。

#13 楼 @subsky 这种时候应该机智地推广一发 asp+access。

#13 楼 @subsky 开个虚拟机部署。

VMware 创建一个 Linux 虚拟机,一些 gem 只兼容 Linux 环境,因为服务器都是 Linux 的

You need to Sign in before reply, if you don't have an account, please Sign up first.