Deploy with jekyll-paginate-v2 fails


#1

I just added pagination to my website, and everything works locally. In my local _config.yml I have:

gems: [jekyll-paginate-v2]
pagination:
  enabled: true
  per_page: 3
  permalink: '/page/:num/'
  title_suffix: ' - page :num'
  limit: 0
  sort_field: 'date'
  sort_reverse: true

In my local and remote Gemfiles I have:

group :jekyll_plugins do
  gem "jekyll-paginate-v2"
end

I deploy on Digital Ocean using a script that automatically builds and moves files into my public www folder. When the script gets to jekyll build --source $TMP_GIT_CLONE --destination $PUBLIC_WWW I get an error:

Dependency Error: Yikes! It looks like you don't have jekyll-paginate-v2 or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-paginate-v2'

When I run bundle update remotely I get:

Using public_suffix 3.0.1
Using addressable 2.5.2
Using backports 3.11.0
Using bundler 1.16.1
Using colorator 1.1.0
Using diff-lcs 1.3
Using ffi 1.9.18
Using forwardable-extended 2.6.0
Using rb-fsevent 0.10.2
Using rb-inotify 0.9.10
Using sass-listen 4.0.0
Using sass 3.5.4
Using jekyll-sass-converter 1.5.1
Using ruby_dep 1.5.0
Using listen 3.1.5
Using jekyll-watch 1.5.1
Using kramdown 1.16.2
Using liquid 4.0.0
Using mercenary 0.3.6
Using pathutil 0.16.1
Using rouge 2.2.1
Using safe_yaml 1.0.4
Using jekyll 3.6.2
Using rack 1.6.8
Using rack-protection 1.5.3
Using tilt 2.0.8
Using sinatra 1.4.8
Using multi_json 1.12.2
Using rack-test 0.8.2
Using sinatra-contrib 1.4.7
Using jekyll-admin 0.7.0
Using jekyll-paginate-v2 1.9.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.1
Using rspec-support 3.7.0
Using rspec-core 3.7.0
Using rspec-expectations 3.7.0
Using rspec-mocks 3.7.0
Using rspec 3.7.0

I’m not sure what else to do!


#2

are you just doing jekyll build or bundle exec jekyll build? bundle exec is what installs the dependicies unless you are doing that some other way. At least that is my understanding - I am not using any plugins.


#3

@rdyar I’m only doing jekyll build. I will try bundle exec jekyll build. Thanks!


#4

Unfortunately I have a new error:
remote: Could not locate Gemfile or .bundle/ directory

Everything was working before I went down the path of installing jekyll-paginate-v2.


#5

Some more information:

When I try to run bundle install I get an error:
public_suffix-3.0.1 requires ruby version >= 2.1, which is incompatible with the current version, ruby 2.0.0p648

I wonder if that’s related.


#6

Ok I updated Ruby and ran bundle install again. Everything is updated. No progress sadly.


#7

I just tried using jekyll-paginate and got the same result when I deployed:

Dependency Error: Yikes! It looks like you don't have jekyll-paginate or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-paginate' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!


#8

bundler is supposed to install the dependencies from your gemfile. you could also just try manually installing them - gem install jekyll-paginate-v2 maybe that would bypass whatever problem bundler is having with installing them or show you a different error.


#9

Oh I’m using this method to deploy:


#10

Yup yup both versions of the plugin are installed.

gem install jekyll-paginate
Successfully installed jekyll-paginate-1.1.0
Parsing documentation for jekyll-paginate-1.1.0
Done installing documentation for jekyll-paginate after 0 seconds
1 gem installed

gem install jekyll-paginate-v2
Successfully installed jekyll-paginate-v2-1.9.0
Parsing documentation for jekyll-paginate-v2-1.9.0
Done installing documentation for jekyll-paginate-v2 after 1 seconds
1 gem installed

#11

and now what is the error? same dependency error?


#12

Hi @diklein
I had a look at the deployment method you’re using… and to me, it looks like Bundler isn’t reading the repo’s Gemfile as expected.

One can manually set the BUNDLE_GEMFILE ENV variable to the repo’s Gemfile. So your updated hooks/post-receive will look like…:

GIT_REPO=$HOME/myrepo.git
TMP_GIT_CLONE=$HOME/tmp/myrepo
GEMFILE=$TMP_GIT_CLONE/Gemfile
PUBLIC_WWW=/var/www/myrepo

git clone $GIT_REPO $TMP_GIT_CLONE
BUNDLE_GEMFILE=$GEMFILE bundle install
BUNDLE_GEMFILE=$GEMFILE bundle exec jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit

Let me know if that works for you…


#13

Yes unfortunately. I suppose you see “1 gem installed” even if the gem is already installed?


#14

Thanks! Here’s what I get:

remote: Cloning into '/home/diklein/tmp/git/revamp'...
remote: done.
remote: Fetching gem metadata from https://rubygems.org/..........
remote: public_suffix-3.0.0 requires ruby version >= 2.1, which is incompatible with the
remote: current version, ruby 2.0.0p648
remote: /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find public_suffix-3.0.0 in any of the sources (Bundler::GemNotFound)
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `map!'
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `materialize'
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs'
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for'
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
remote: 	from /home/diklein/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.16.1/lib/bundler/setup.rb:20:in `<top (required)>'
remote: 	from /home/diklein/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
remote: 	from /home/diklein/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'

Looks like my version or Ruby is old? But when I run ruby -v I get:

ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]

I updated Ruby last night. Do I need to reboot the server for the change to take place?

Thanks!


#15

Ok I restarted nginx and then ubuntu. Both times I see:

ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]

So that’s a problem! How does one actually update Ruby?


#16

I updated rvm and reinstalled Ruby. I see that I supposedly have ruby 2.4.1p111.

Same error when I try to deploy. public_suffix requires ruby >= 2.1.


#17

After I reboot unbuntu and run ruby -v:

ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]

Harrumph!


#18

A new state! There’s a lot of stuff here. I’m not sure where to begin. Fix ffi?

remote: Ignoring executable-hooks-1.3.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.3.2
remote: Ignoring gem-wrappers-1.3.2 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.3.2
remote: Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: Fetching gem metadata from https://rubygems.org/...........
remote: Fetching version metadata from https://rubygems.org/...
remote: Fetching dependency metadata from https://rubygems.org/..
remote: Installing public_suffix 3.0.0
remote: Installing backports 3.10.3
remote: Installing colorator 1.1.0
remote: Installing diff-lcs 1.3
remote: Installing ffi 1.9.18 with native extensions
remote: 
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote: 
remote:     current directory: /home/diklein/.rvm/gems/ruby-2.4.2/gems/ffi-1.9.18/ext/ffi_c
remote: /usr/bin/ruby2.3 -r ./siteconf20180103-3870-rt2cmc.rb extconf.rb
remote: mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
remote: 
remote: extconf failed, exit code 1
remote: 
remote: Gem files will remain installed in /home/diklein/.rvm/gems/ruby-2.4.2/gems/ffi-1.9.18 for inspection.
remote: Results logged to /home/diklein/.rvm/gems/ruby-2.4.2/extensions/x86_64-linux/2.3.0/ffi-1.9.18/gem_make.out
remote: Installing forwardable-extended 2.6.0
remote: Installing rb-fsevent 0.10.2
remote: Installing kramdown 1.15.0
remote: Installing liquid 4.0.0
remote: Installing mercenary 0.3.6
remote: Installing rouge 2.2.1
remote: Installing safe_yaml 1.0.4
remote: Installing rack 1.6.8
remote: Installing tilt 2.0.8
remote: Installing multi_json 1.12.2
remote: Installing jekyll-paginate 1.1.0
remote: Installing mini_portile2 2.3.0
remote: Installing rspec-support 3.7.0
remote: Using bundler 1.11.2
remote: Installing addressable 2.5.2
remote: An error occurred while installing ffi (1.9.18), and Bundler cannot continue.
remote: Make sure that `gem install ffi -v '1.9.18'` succeeds before bundling.
remote: /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:94:in `block in materialize': Could not find ffi-1.9.18 in any of the sources (Bundler::GemNotFound)
remote: 	from /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:87:in `map!'
remote: 	from /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:87:in `materialize'
remote: 	from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:137:in `specs'
remote: 	from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:182:in `specs_for'
remote: 	from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:171:in `requested_specs'
remote: 	from /usr/lib/ruby/vendor_ruby/bundler/environment.rb:18:in `requested_specs'
remote: 	from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:13:in `setup'
remote: 	from /usr/lib/ruby/vendor_ruby/bundler.rb:92:in `setup'
remote: 	from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:18:in `<top (required)>'
remote: 	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
remote: 	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'

#19

It’s working! It’s working! Thank you so much!

Question: It took approximately 1 minute to deploy because of all this. Is that the new normal for me? I saw a long pause here:

remote: Installing nokogiri 1.8.1 with native extensions


#20

Note: Deploying the next time only took a few seconds!

Thank you all so much for your help!!