Bundle exec jekyll build failing on remote Ubuntu 20.04.1

I’m really stuck! I have a working local setup on Mac for a particular project, but when I deploy to either Docker (Buddy) or a Droplet on Digital Ocean I get the following build error;

user@remote_droplet:~/jekyll_project$ bundle exec jekyll serve
bundler: failed to load command: jekyll (/home/user/gems/bin/jekyll)
Traceback (most recent call last):
	40: from /home/user/gems/bin/bundle:23:in `<main>'
	39: from /home/user/gems/bin/bundle:23:in `load'
	38: from /home/user/gems/gems/bundler-2.2.0/exe/bundle:37:in `<top (required)>'
	37: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
	36: from /home/user/gems/gems/bundler-2.2.0/exe/bundle:49:in `block in <top (required)>'
	35: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/cli.rb:24:in `start'
	34: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	33: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/cli.rb:30:in `dispatch'
	32: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	31: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	30: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	29: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/cli.rb:497:in `exec'
	28: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/cli/exec.rb:28:in `run'
	27: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/cli/exec.rb:63:in `kernel_load'
	26: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/cli/exec.rb:63:in `load'
	25: from /home/user/gems/bin/jekyll:23:in `<top (required)>'
	24: from /home/user/gems/bin/jekyll:23:in `load'
	23: from /home/user/gems/gems/jekyll-4.1.1/exe/jekyll:11:in `<top (required)>'
	22: from /home/user/gems/gems/jekyll-4.1.1/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
	21: from /home/user/gems/gems/bundler-2.2.0/lib/bundler.rb:174:in `require'
	20: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/runtime.rb:50:in `require'
	19: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/runtime.rb:50:in `each'
	18: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/runtime.rb:61:in `block in require'
	17: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/runtime.rb:61:in `each'
	16: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
	15: from /home/user/gems/gems/bundler-2.2.0/lib/bundler/runtime.rb:66:in `require'
	14: from /home/user/gems/gems/jekyll-autoprefixer-1.0.2/lib/jekyll-autoprefixer.rb:7:in `<top (required)>'
	13: from /home/user/gems/gems/jekyll-autoprefixer-1.0.2/lib/jekyll-autoprefixer.rb:7:in `require_relative'
	12: from /home/user/gems/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer.rb:4:in `<top (required)>'
	11: from /home/user/gems/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer.rb:5:in `<module:Jekyll>'
	10: from /home/user/gems/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer.rb:8:in `<module:Autoprefixer>'
	 9: from /home/user/gems/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer.rb:8:in `require_relative'
	 8: from /home/user/gems/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:4:in `<top (required)>'
	 7: from /home/user/gems/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:4:in `require'
	 6: from /home/user/gems/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails.rb:39:in `<top (required)>'
	 5: from /home/user/gems/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails.rb:39:in `require_relative'
	 4: from /home/user/gems/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails/processor.rb:4:in `<top (required)>'
	 3: from /home/user/gems/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails/processor.rb:4:in `require'
	 2: from /home/user/gems/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
	 1: from /home/user/gems/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/home/user/gems/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

I get the exact same error on a buddy.works docker (tried their ruby, jekyll and custom builds).

In both environment (the droplet and the docker),

jekyll new mysite
cd mysite
bundle exec jekyll build

works fine.

Gemfile for the build that fails (except on my local env):

source 'https://rubygems.org'
gem 'jekyll'
group :jekyll_plugins do
  gem 'jekyll-feed'
  gem 'jekyll-paginate'
  gem 'jekyll-autoprefixer'
  gem 'jekyll-sitemap'
  gem 'jekyll-target-blank'
  gem 'jekyll-image-size', '~> 1.2'
  gem 'kramdown-parser-gfm', '~> 1.1'
  gem 'jekyll_picture_tag'
end

I’ve tried everything I think of to trouble shoot, any ideas what I can do to track down what the difference is between my local env and these remote ones?

The first and last lines of a traceback are most useful. Your last line is telling you that JavaScript can’t be installed so make sure you have Node.js installed on the environment.

Also would recommend pinning Jekyll to avoid unexpected breaking changes and to make to clear you are using 4 and not 3.

gem 'jekyll', '~> 4.1'

Thank you! I got this working on my droplet, nodejs was missing :man_facepalming: Still no luck with Buddy.Works but I might move to travis anyway.

1 Like