使用插件jekyll_lunr_js_search编译Jekyll项目时,在Windows中始终会出现以下错误。但是它在gitlabci上编译。
依赖性错误:哎呀!看起来您没有安装D:/myproject/_plugins/lunrjs/jekyll_lunr_js_search.rb或其中一个依赖项。为了使用当前配置的Jekyll,您需要安装此gem。来自Ruby的完整错误消息是:'无法加载此类文件 - v8'如果遇到问题,可以在https://jekyllrb.com/help/找到有用的资源!
使用gem install jekyll-lunr-js-search
以下错误:
C:\MyProj>gem install jekyll-lunr-js-search
Fetching: json-2.0.3.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed json-2.0.3
Fetching: ref-2.0.0.gem (100%)
Successfully installed ref-2.0.0
Fetching: libv8-3.16.14.19.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing jekyll-lunr-js-search:
ERROR: Failed to build gem native extension.
current directory: C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19/ext/libv8
C:/APPs/Ruby23-x64/bin/ruby.exe -r ./siteconf20170310-14120-1y669dw.rb extconf.rb
creating Makefile
The system cannot find the path specified.
C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19/ext/libv8/builder.rb:86:in `setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently 3.4.4 (RuntimeError)
from C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19/ext/libv8/builder.rb:53:in `build_libv8!'
from C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:24:in `install!'
from extconf.rb:7:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19 for inspection.
Results logged to C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/libv8-3.16.14.19/gem_make.out
**文件内容(gem_make.out)**
current directory: C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19/ext/libv8
C:/APPs/Ruby23-x64/bin/ruby.exe -r ./siteconf20170310-14120-1y669dw.rb extconf.rb
creating Makefile
The system cannot find the path specified.
C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19/ext/libv8/builder.rb:86:in `setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently 3.4.4 (RuntimeError)
from C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19/ext/libv8/builder.rb:53:in `build_libv8!'
from C:/APPs/Ruby23-x64/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:24:in `install!'
from extconf.rb:7:in `<main>'
extconf failed, exit code 1
注意:
我已经安装了python v2和v3并且工作正常。使用py -2
输出的测试python shell如下:
C:\>py -2
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
答案 0 :(得分:0)
如果你查看lib
目录,你会发现ruby文件是jekyll-lunr-js-search.rb
而不是jekyll_lunr_js_search.rb
。此外,它还可以作为Rubygem包使用。
只需将gem添加到:jekyll_plugins
中的Gemfile
群组,然后运行bundle install
,然后继续使用Jekyll进行构建/服务。