Reputation: 759
I'm trying to install lunr.js on a jekyll site, and I get this error:
Users/tjohnson/projects/resolve/_plugins/jekyll_lunr_js_search.rb:5:in `require': cannot load such file -- v8 (LoadError)
from /Users/tjohnson/projects/resolve/_plugins/jekyll_lunr_js_search.rb:5:in `<top (required)>'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/plugin_manager.rb:58:in `require'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/plugin_manager.rb:58:in `block (2 levels) in require_plugin_files'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/plugin_manager.rb:57:in `each'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/plugin_manager.rb:57:in `block in require_plugin_files'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/plugin_manager.rb:56:in `each'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/plugin_manager.rb:56:in `require_plugin_files'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/plugin_manager.rb:18:in `conscientious_require'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/site.rb:74:in `setup'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/site.rb:36:in `initialize'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:28:in `new'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:28:in `process'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/lib/jekyll/commands/serve.rb:25:in `block (2 levels) in init_with_program'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/gems/jekyll-2.4.0/bin/jekyll:18:in `<top (required)>'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/bin/jekyll:23:in `load'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/bin/jekyll:23:in `<main>'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
from /Users/tjohnson/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `<main>'
I'm trying to follow the instructions on https://github.com/slashdotdash/jekyll-lunr-js-search, but I'm somewhat new to Jekyll, so I may not be understanding everything. There are two ways to install it: using a rubygem or downloading the pre-built plugin file directly. I chose the latter. Here are the steps I took:
<script src="{{ "/javascripts/search.min.js" | prepend:site.baseurl }}">
</script>
<script src="{{ "/javascripts/jquery.lunr.search.js" | prepend:site.baseurl}}"></script>
<script type="text/javascript">
$(function() {
$('#search-query').lunrSearch({
indexUrl: '/js/index.json', // Url for the .json file containing search index data
results : '#search-results', // selector for containing search results element
entries : '.entries', // selector for search entries containing element (contained within results above)
template: '#search-results-template' // selector for Mustache.js template
});
});
</script>
<div id="search">
<form action="/search" method="get">
<input type="text" id="search-query" name="q" placeholder="Search" autocomplete="off">
</form>
</div>
and this results container right below the form on the same page:
<section id="search-results" style="display: none;">
<p>Search results</p>
<div class="entries">
</div>
</section>
and this mustache template right below it:
{% raw %}
<script id="search-results-template" type="text/mustache">
{{#entries}}
<article>
<h3>
{{#date}}<small><time datetime="{{pubdate}}" pubdate>{{displaydate}}</time></small>{{/date}}
<a href="{{url}}">{{title}}</a>
</h3>
</article>
{{/entries}}
</script>
{% endraw %}
Now when I build my jekyll site, I get the error I listed earlier. (I don't get this error without the plugin.) Any ideas? I really need a search feature on my site, and this one seems to be the best.
Upvotes: 2
Views: 675
Reputation: 2419
Try installing the libv8
Ruby gem first.
gem install libv8 -v '3.16.14.7'
or
gem install libv8 -v '3.16.14.7' -- --with-system-v8
Then install the latest version of the jekyll_lunr_js_search
gem.
gem install jekyll-lunr-js-search
Finally, include a reference to the plugin gem in your Jekyll site's _config.yml
config file.
gems: ['jekyll-lunr-js-search']
Upvotes: 0