我正在尝试在运行 Windows 8.1 的本地计算机上运行 jekyll,我已经安装并运行了 Ruby,但每次运行 jekyll serve
命令时,我都会收到错误消息:
C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- hitimes/hitimes (LoadError)
我已经尝试通过 gem install hitimes
手动安装 hitimes,它工作正常,如果我打开 irb
我可以 require 'hitimes'
没问题,它似乎对 jekyll 不起作用。
我的 gem 环境
是:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.1 (2015-02-26 patchlevel 85) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby22/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: C:/Ruby22/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby22/bin
- SPEC CACHE DIRECTORY: C:/Users/adam.laycock/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby22/lib/ruby/gems/2.2.0
- C:/Users/adam.laycock/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- C:\RubyDevKit\bin
- C:\RubyDevKit\mingw\bin
- C:\windows\system32
- C:\windows
- C:\windows\System32\Wbem
- C:\windows\System32\WindowsPowerShell\v1.0\
- C:\Program Files\nodejs\
- C:\Users\adam.laycock\AppData\Roaming\npm
- C:\Users\adam.laycock\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\cmd
- C:\Users\adam.laycock\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin
- C:\Users\adam.laycock\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\mingw\bin
- C:\Users\adam.laycock\AppData\Local\Apps\2.0\O3WGNDW8.VMM\C2M3657K.JNR\gith..tion_317444273a93ac29_0002.000a_7c768ac46c12be54
- C:\windows\Microsoft.NET\Framework\v4.0.30319
- C:\Ruby22\Bin
jekyll -v
返回 2.5.3
最佳答案
这可能与 Ruby 2.2 中的一些重大 ABI 更改有关,hitimes-1.2.2-x86-mingw32
不包含 Ruby 2.2 的 fat 二进制文件。
修复方法是卸载并重新安装它,并在安装时使用 --platform ruby
。
那么这样做:
gem uni hitimes
**Remove ALL versions**
gem ins hitimes -v 1.2.1 --platform ruby
这将重新编译与 Ruby 2.2 兼容的 hitimes
。
编辑:作为copiousfreetime mentioned in the comments , RubyInstaller DevKit需要编译二进制 rubygems
版本 1.2.3
及以上的 hitimes
应该包含 Ruby 2.2.X
版本的胖二进制文件。 Thanks copiousfreetime
关于ruby - 在 Windows 8.1 上运行 jekyll serve 时出现 hitimes require 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28985481/