jekyll-multiple-languages-plugin cannot be found - ruby

I'm newbie to Ruby and Jekyll. Recently I've tried to install Jekyll Multiple Languages Plugin onto my GitLab Pages instance. I've managed to successfully add
'gem install jekyll-multiple-languages-plugin
bundle install'
into the .gitlab-ci.yml but when I try to add
gems:
jekyll-multiple-languages-plugin
into _config.yml in order to use it on the site my commit fails with the following error:
Using jekyll-watch 1.5.0
Using jekyll 3.4.3
Bundle complete! 3 Gemfile dependencies, 20 gems now installed.
Bundled gems are installed into /usr/local/bundle.
$ jekyll build -d public
Configuration file: /builds/myusername/forty-jekyll-theme/_config.yml
Dependency Error: Yikes! It looks like you don't have jekyll-multiple-languages-plugin 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-multiple-languages-plugin' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.4.3 | Error: jekyll-multiple-languages-plugin
ERROR: Job failed: exit code 1
I have used this method because any attempt to edit Gemfile ends up in commit error. I've also tried to do all presented steps except adding bundle install. In that case I get the same error, but the beginning looks like:
18 gems installed
$ gem install jekyll-multiple-languages-plugin
Successfully installed jekyll-multiple-languages-plugin-1.5.1
1 gem installed
$ jekyll build -d public
I did not manage to find the way to solve it on Stack Overflow nor other sites. For example this did not help

With the awesome support of allejo from Jekyll's IRC channel I've managed to solve the problem. Here are the steps:
I've used Gemfile. Now it looks like
source 'https://rubygems.org'
gem 'jekyll'
group :jekyll_plugins do
gem 'jekyll-multiple-languages-plugin'
end
The second modified thing was .gitlab-ci.yml (the first line - image: ruby - is also included)
image: ruby
pages:
stage: build
script:
# - gem install jekyll
- gem install bundler
# - gem install jekyll-multiple-languages-plugin
- bundle install
- bundle exec jekyll build -d public
# - jekyll build -d public
artifacts:
paths:
- public
only:
- master
It produced a bug, but it was only caused by the lack of declared language which is part of standard plugin configuration.

Related

Error upon `bundle exec jekyll 3.8.7 new .` for Github Pages

Goal
Initiate a Github Page using Jekyll. I'm following the Github Pages docs.
Problem
Upon executing:
bundle exec jekyll 3.8.7 new .
The following error is returned:
fatal: 'jekyll 3.8.7' could not be found. You may need to install the jekyll-3.8.7 gem or a related gem to be able to use this subcommand..
Also note that (a) Jekyll 3.8.7 is the current dependency version for Github Pages and (b) the same error is returned if I attempt it for Jekyll 4.1.0.
Context
I tried the recommendation in this SO post -- $ bundle init, $ bundle add jekyll -- but that didn't solve my problem.
System details:
$ which ruby
/Users/vishrutarya/.rbenv/shims/ruby
$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
$ jekyll -v
jekyll 4.1.0
$ which jekyll
/Users/vishrutarya/.gem/ruby/2.7.0/bin/jekyll
For me, adding underscores did the trick.
I installed version 3.8.7 manually. With gem list, you can check if it is
actually installed.
Then i used bundle exec jekyll _3.8.7_ new . --force and it worked.
Ran into the same issue on MacOS. This is what I ended up doing:
Create a new dir, let's call it blog
Run bundle init
In the Gemfile, add the line gem "jekyll", "= 3.8.7"
Run bundle i
You can verify the jekyll version by issuing bundle exec jekyll -v
Create a docs/ directory in the same folder
Run bundle exec jekyll new .
Run bundle i again in docs/ directory
To serve, run bundle exec jekyll serve in the docs/ directory
I hope this helps!

jekyll serve isn't working for dependency error

While trying to run the jekyll serve in GitBash(Win10),I got the following error:
$ jekyll server
Configuration file: D:/Blog/mysite/_config.yml
Source: D:/Blog/mysite
Destination: D:/Blog/mysite/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 3.25 seconds.
Dependency Error: Yikes! It looks like you don't have jekyll-watch 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 -- ruby_dep/warning' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.7.3 | Error: jekyll-watch·
I was trying to solve the error via these ways:jekyll serve shows a dependency error,but it didn't work.
according to the prompt, I installed the jekyll-watch again, and then I ran jekyll serve again, the same error was coming up again. In other words, it didn't work for me.
$ jekyll server
Configuration file: D:/Blog/mysite/_config.yml
Source: D:/Blog/mysite
Destination: D:/Blog/mysite/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 3.25 seconds.
Dependency Error: Yikes! It looks like you don't have jekyll-watch 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 -- ruby_dep/warning' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.7.3 | Error: jekyll-watch
I tried to bundle install,and then ran $ bundle exec jekyll serve,the another error was coming...
$ bundle exec jekyll serve
D:/rubyInstall/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll.rb:35:in 'require': cannot load such file -- i18n (LoadError)
from D:/rubyInstall/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll.rb:35:in '<top (required)>'
from D:/rubyInstall/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/exe/jekyll:8:in 'require'
from D:/rubyInstall/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/exe/jekyll:8:in '<top (required)>'
from D:/rubyInstall/Ruby25-x64/bin/jekyll:23:in 'load'
from D:/rubyInstall/Ruby25-x64/bin/jekyll:23:in '<main>'
Remove the Gemfile.lock file and run bundle install once again.
This is what #ashmaroli was suggesting in the comments and it worked.
The reason I asked you to post the output from bundle show is to assess if all the dependencies have been installed successfully.
If you go through the first error output, you'll see the following:
The full error message from Ruby is: 'cannot load such file -- ruby_dep/warning'
This means that the gem ruby_dep did not install properly. (ruby_dep is a second-order dependency of jekyll-watch)
So, the question here is,
"Where you able to finish bundle install completely without any errors?"
If no, you probably need to install the Ruby Devkit for your Ruby version by running the following:
$ ridk install

Loading local libaries in jekyll (Liquid template library + ruby bundler)

My question is: How do I load local libaries in ruby and with bundler + jekyll?
I'm trying to load a bunch of local libraries.
For example: project_root/_plugins/fileexists.rb
I've tried following https://jekyllrb.com/docs/plugins/ but that solution assumes you have a library that can be installed from the global Gem repository.
The plugins I'm trying to load are here https://github.com/nicnocquee/appolo/tree/master/_plugins
The error I'm getting when doing 'bundle exec jekyll serve':
Dependency Error: Yikes! It looks like you don't have fileexists 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 -- fileexists' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
To complicate the matter, I'm using the Liquid template library. (Though this shouldnt be a Liquid problem because I get the error when doing bundle exec jekyll serve. I think..)
{% file_exists {{ fb_img_default }} %}
The code for the template is here:
https://github.com/nicnocquee/appolo/blob/master/_includes/head.html#L25
My _config.yml file for jekyll: https://pastebin.com/SphuLcVt
The Gemfile: https://pastebin.com/3ptcBx5m
Thanks in advance for ideas about how to proceed!
Library version
bundle --version
Bundler version 1.16.0
ruby --version
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
gem --version
2.5.2
Ok, I figured this out.
I removed:
plugins:
- fileexists
From _config.yml
And removed:
gem 'fileexists', :path => '/home/test/xxx.github.io/_plugins/fileexists'
gem 'github-pages'
from Gemfile
The clue that github-pages packet was the problem: https://github.com/jekyll/jekyll/issues/5990#issuecomment-308231021
Short answer:
"No custom plugins will load when using github-pages because of their whitelist."

The git source is not yet checked out when running Docker

I'm currently facing an error when trying to use a gem from GitHub. I have the following in my Gemfile:
# Gemfile
source 'https://rubygems.org'
ruby '2.3.1'
gem 'sinatra'
gem 'rack'
gem 'puma'
group :development do
gem 'byebug'
gem 'rack-test'
gem 'rerun', github: 'alexch/rerun', branch: 'master'
end
When I run bundle install from Dockerfile it works with a message like:
...
Installing sinatra 1.4.6
Installing listen 3.1.5 (was 3.0.6)
Using rerun 0.11.0 from git://github.com/alexch/rerun.git (at master#3e4c486)
Bundle complete! 6 Gemfile dependencies, 14 gems now installed.
...
However, when I go to start the container I get:
The git source git://github.com/alexch/rerun.git is not yet checked out. Please run `bundle install` before trying to start your application
I've seen similar issues but not related to Docker.
Turns out I was able to find the issue. The problem was related to my Gemfile being used to build the Docker image.
I had not locally run a bundle install command which led to the Gemfile.lock not being updated. Once I ran the command the following was added to my Gemfile.lock:
## -1,14 +1,20 ##
+GIT
+ remote: git://github.com/alexch/rerun.git
+ revision: 3e4c486304be406cb86180ef70ec24e9ae055ce4
+ branch: master
+ specs:
+ rerun (0.11.0)
+ listen (~> 3.0)
Turns out that was all I needed. Once I had the updated file, rebuilt the image and ran the container everything worked as expected with bundle exec rerun. So the catch was that I was using the Gemfile.lock to help with caching / version locking but failed to keep it updated with my Gemfile.
In case anyone is interested there's an alternative.
During image creation, if your dockerfile runs bundle install it will generate a Gemfile.lock in the container. You can use docker run to get the contents, e.g.
docker run web cat Gemfile.lock
You can copy the contents and save a Gemfile.lock to your project directory.
Worked to me:
docker-compose run web bundle install

Locally install a gem built with platform=java | JRuby 1.7.18

It seems that the workflow that I use to build and install gems locally does not translate when the gemspec has platform = "java".
I am using Jruby 1.7.18, installed with rvm
$ which gem
/Users/USERNAME/.rvm/rubies/jruby-1.7.18/bin/gem
When I build a gem with the default platform, everything goes according to plan:
$ grep platform batching_core.gemspec
# spec.platform = "java"
$ gem build batching_core.gemspec
Successfully built RubyGem
Name: batching_core
Version: 0.1.0
File: batching_core-0.1.0.gem
$ gem install batching_core-0.1.0.gem
jar dependencies found on non-java platform gem - do not install jars
Successfully installed batching_core-0.1.0
1 gem installed
Note the success message of "Successfully installed batching_core-0.1.0"
But when my project requires me to use platform=java so that I can require some jar files. I can build the gem, but I cannot install it. The installation ends without the success message, and I cannot require the gem in irb:
$ grep platform batching_core.gemspec
spec.platform = "java"
$ gem build batching_core.gemspec
Successfully built RubyGem
Name: batching_core
Version: 0.1.0
File: batching_core-0.1.0-java.gem
$ gem install batching_core-0.1.0-java.gem
$
^^ Note the lack of output. No success message, no output at all.
$ irb
jruby-1.7.18 :001 > require 'batching_core'
LoadError: no such file to load -- batching_core
from org/jruby/RubyKernel.java:1071:in `require'
from /Users/USERNAME/.rvm/rubies/jruby-1.7.18/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
I tried the solution suggested here, but got the same result.
Creating a gem using Jruby and not Ruby
EDIT: Here's the project that causes the issue:
https://github.com/ValerieAnne563/so34754484
It looks to me like the gem does not contain the file you're trying to require. Can you check the contents to see if "batching_core.rb" is in the gem's lib dir?
As for the warning...I'm confused about your environment. This is a gem with a jar in it being installed on JRuby? Maybe it would clarify some things if you link to the project or post the gemspec.

Resources