2

我正在寻找这个 github 问题的答案: https ://github.com/guard/listen/issues/399

我正在使用 Windows 7 并尝试运行bundle install. 我收到以下错误:

mysys:# bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies..................................................................................................
.............................................................................................................
Using rake 11.1.2
Using addressable 2.3.8
Using multipart-post 2.0.0
Using httpclient 2.6.0.1
Using buff-extensions 1.0.0
Using hashie 2.1.2
Using buff-ruby_engine 0.1.0
Using hitimes 1.2.4
Using nio4r 1.2.1
Using cleanroom 1.0.0
Using minitar 0.5.4
Using retryable 2.0.3
Using buff-ignore 1.1.1
Using erubis 2.7.0
Using json 1.8.3
Using mixlib-log 1.6.0
Using rspec-support 3.4.1
Using diff-lcs 1.2.5
Using semverse 1.2.1
Using molinillo 0.4.5
Using thor 0.19.1
Using ffi 1.9.10
Using libyajl2 1.2.0
Using rack 1.6.4
Using highline 1.7.8
Using mime-types 1.25.1
Using mixlib-cli 1.6.0
Using mixlib-config 2.2.1
Using win32-api 1.5.1
Using net-ssh 2.9.4
Using ipaddress 0.8.3
Using systemu 2.6.5
Using wmi-lite 1.0.0
Using plist 3.1.0
Using coderay 1.1.1
Using method_source 0.8.2
Using slop 3.6.0
Using multi_json 1.12.1
Using nokogiri 1.5.11
Using polyglot 0.3.5
Using yajl-ruby 1.1.0
Using formatador 0.2.5
Using rb-fsevent 0.9.7
Using ruby_dep 1.3.1
Using lumberjack 1.0.10
Using nenv 0.3.0
Using shellany 0.0.1
Using guard-compat 1.2.1
Using safe_yaml 1.0.4
Using ruby-wmi 0.4.0
Using ruby_gntp 0.3.4
Using wdm 0.1.1
Using bundler 1.12.4
Using faraday 0.9.2
Using varia_model 0.4.1
Using buff-shell_out 0.2.0
Using timers 4.0.4
Using rspec-core 3.4.4
Using rspec-expectations 3.4.0
Using rspec-mocks 3.4.1
Using solve 2.0.3
Using win32-process 0.7.3
Using win32-dir 0.4.5
Using win32-ipc 0.6.6
Using win32-mmap 0.4.0
Using win32-service 0.8.2
Using rb-inotify 0.9.7
Using rb-fchange 0.0.6
Installing ffi-yajl 1.4.0 with native extensions

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

current directory: C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
C:/opscode/chefdk/embedded/bin/ruby.exe -r ./siteconf20160604-8548-n39nif.rb extconf.rb
-IC:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/include -IC:/opscode/chefdk/embedded/include -O3 -march=i686 -DFD_SETSIZE=2048
-LC:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/lib -L. -LC:/opscode/chefdk/embedded/lib
creating Makefile

current directory: C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
make "DESTDIR=" clean

current directory: C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
make "DESTDIR="
generating encoder-i386-mingw32.def
compiling encoder.c
linking shared-object ffi_yajl/ext/encoder.so
c:/opscode/chefdk/embedded/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lyajldll
collect2.exe: error: ld returned 1 exit status
make: *** [encoder.so] Error 1

make failed, exit code 2

Gem files will remain installed in C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ffi-yajl-1.4.0 for inspection.
Results logged to C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/ffi-yajl-1.4.0/gem_make.out
Using rest-client 1.6.7
Using windows-api 0.4.2
Using net-ssh-gateway 1.2.0
Using fauxhai 3.5.0
Using net-scp 1.2.1
Using pry 0.10.3
Using gherkin 2.11.8
Using treetop 1.4.15
Using notiffany 0.1.0
Using berkshelf-api-client 2.0.0
Using sawyer 0.7.0
Using buff-config 1.0.1
Using celluloid 0.16.0
Using mixlib-authentication 1.4.0
Using rspec 3.4.0
Using win32-event 0.6.1
Using win32-mutex 0.4.1
Installing listen 3.1.5

Gem::InstallError: listen requires Ruby version >= 2.2.3, ~> 2.2.
An error occurred while installing ffi-yajl (1.4.0), and Bundler cannot
continue.
Make sure that gem install ffi-yajl -v '1.4.0' succeeds before bundling.
PS C:\Users\502620480\githubci\og_app_bp-poa-ui> gem install ffi-yajl -v '1.4.0'
Fetching: ffi-1.9.10-x64-mingw32.gem (100%)
Successfully installed ffi-1.9.10-x64-mingw32
Fetching: libyajl2-1.2.0.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed libyajl2-1.2.0
Fetching: ffi-yajl-1.4.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed ffi-yajl-1.4.0
Parsing documentation for ffi-1.9.10-x64-mingw32
Installing ri documentation for ffi-1.9.10-x64-mingw32
Parsing documentation for libyajl2-1.2.0
unable to convert "\xD0" from ASCII-8BIT to UTF-8 for ext/libyajl2/vendor/yajl/test/parsing/cases/invalid_utf8.json, ski
pping
unable to convert "\x92" from ASCII-8BIT to UTF-8 for ext/libyajl2/vendor/yajl/test/parsing/cases/non_utf8_char_in_strin
g.json, skipping
Installing ri documentation for libyajl2-1.2.0
Parsing documentation for ffi-yajl-1.4.0
Installing ri documentation for ffi-yajl-1.4.0
Done installing documentation for ffi, libyajl2, ffi-yajl after 4 seconds
3 gems installed
PS C:\Users\502620480\githubci\og_app_bp-poa-ui> bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies..................................................................................................
.............................................................................................................
Using rake 11.1.2
Using addressable 2.3.8
Using multipart-post 2.0.0
Using httpclient 2.6.0.1
Using buff-extensions 1.0.0
Using hashie 2.1.2
Using buff-ruby_engine 0.1.0
Using hitimes 1.2.4
Using nio4r 1.2.1
Using cleanroom 1.0.0
Using minitar 0.5.4
Using retryable 2.0.3
Using buff-ignore 1.1.1
Using erubis 2.7.0
Using json 1.8.3
Using mixlib-log 1.6.0
Using rspec-support 3.4.1
Using diff-lcs 1.2.5
Using semverse 1.2.1
Using molinillo 0.4.5
Using thor 0.19.1
Using ffi 1.9.10
Using libyajl2 1.2.0
Using rack 1.6.4
Using highline 1.7.8
Using mime-types 1.25.1
Using mixlib-cli 1.6.0
Using mixlib-config 2.2.1
Using win32-api 1.5.1
Using net-ssh 2.9.4
Using ipaddress 0.8.3
Using systemu 2.6.5
Using wmi-lite 1.0.0
Using plist 3.1.0
Using coderay 1.1.1
Using method_source 0.8.2
Using slop 3.6.0
Using multi_json 1.12.1
Using nokogiri 1.5.11
Using polyglot 0.3.5
Using yajl-ruby 1.1.0
Using formatador 0.2.5
Using rb-fsevent 0.9.7
Using ruby_dep 1.3.1
Using lumberjack 1.0.10
Using nenv 0.3.0
Using shellany 0.0.1
Using guard-compat 1.2.1
Using safe_yaml 1.0.4
Using ruby-wmi 0.4.0
Using ruby_gntp 0.3.4
Using wdm 0.1.1
Using bundler 1.12.4
Using faraday 0.9.2
Using varia_model 0.4.1
Using buff-shell_out 0.2.0
Using timers 4.0.4
Using rspec-core 3.4.4
Using rspec-expectations 3.4.0
Using rspec-mocks 3.4.1
Using solve 2.0.3
Using win32-process 0.7.3
Using win32-dir 0.4.5
Using win32-ipc 0.6.6
Using win32-mmap 0.4.0
Using win32-service 0.8.2
Using rb-inotify 0.9.7
Using rb-fchange 0.0.6
Installing ffi-yajl 1.4.0 with native extensions

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

current directory: C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
C:/opscode/chefdk/embedded/bin/ruby.exe -r ./siteconf20160604-3256-1dpveon.rb extconf.rb
-IC:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/include -IC:/opscode/chefdk/embedded/include -O3 -march=i686 -DFD_SETSIZE=2048
-LC:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/lib -L. -LC:/opscode/chefdk/embedded/lib
creating Makefile

current directory: C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
make "DESTDIR=" clean

current directory: C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
make "DESTDIR="
generating encoder-i386-mingw32.def
compiling encoder.c
linking shared-object ffi_yajl/ext/encoder.so
c:/opscode/chefdk/embedded/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lyajldll
collect2.exe: error: ld returned 1 exit status
make: *** [encoder.so] Error 1

make failed, exit code 2

Gem files will remain installed in C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ffi-yajl-1.4.0 for inspection.
Results logged to C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/ffi-yajl-1.4.0/gem_make.out
Using rest-client 1.6.7
Using windows-api 0.4.2
Using net-ssh-gateway 1.2.0
Using fauxhai 3.5.0
Using net-scp 1.2.1
Using pry 0.10.3
Using gherkin 2.11.8
Using treetop 1.4.15
Using notiffany 0.1.0
Using berkshelf-api-client 2.0.0
Using sawyer 0.7.0
Using buff-config 1.0.1
Using celluloid 0.16.0
Using mixlib-authentication 1.4.0
Using rspec 3.4.0
Using win32-event 0.6.1
Using win32-mutex 0.4.1
Installing listen 3.1.5

Gem::InstallError: listen requires Ruby version >= 2.2.3, ~> 2.2.
An error occurred while installing ffi-yajl (1.4.0), and Bundler cannot
continue.
Make sure that gem install ffi-yajl -v '1.4.0' succeeds before bundling.

我已经安装成功了ffi-yajl,但是运行的时候还是出现同样的错误bundle install

我正在使用以下版本的二进制文件。

$ ruby --version
ruby 2.2.4p230 (2015-12-16 revision 53155) [x64-mingw32]

$ which ruby
/c/Ruby22-x64/bin/ruby

$ which gem
/c/Ruby22-x64/bin/gem

$ which bundler
/c/opscode/chefdk/embedded/bin/bundler

DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

请提出这里的问题是什么?我们从过去 2 周开始一直在尝试,但没有任何成功。

4

2 回答 2

0

我在 ruby​​ 2.4 上遇到了同样的问题。打开 ruby​​ 2.3 对我有用

于 2018-08-13T20:37:26.700 回答
0

如果您无法升级,您可以锁定 Listen to 3.0.x 版本,例如在您的Gemfile中:

gem 'listen', '~> 3.0.8'

那是因为 3.0.x 版本可以安装在旧版本的 Ruby 上,但为了安全起见,3.1 及更高版本没有正式使用过时的 Ruby 版本进行测试。

那应该可以解决 gem install 问题,所以我要关闭它。

https://github.com/guard/listen/issues/399#issuecomment-223800740

于 2020-03-30T13:55:36.320 回答