Getting an error with Jekyll serve - jekyll

Have basically nothing but a _config.yml and index.md file, and when running jekyll serve I'm getting this:
D, [2015-07-08T10:33:29.810161 #14194] DEBUG -- : Celluloid 0.17.0 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
jekyll 2.5.3 | Error: wrong number of arguments (2 for 1)
Please help!

I'm not 100% sure this is the answer for you since I wasn't using Jekyll but I had the same error when I was trying to use compass watch.
Rolling back both Celluloid and Listen did the trick for me.
I added the following to my gemfile:
gem 'listen', '<2.10.0'
gem 'compass', '<0.17.0'

Related

`jekyll build` has error but gitlab ci still continues

I have a Jekyll website running on Gitlab Pages, and one of my pages contained an error.
This error is found and reported by Jekyll, but the website is still deployed, just without that page.
In Gitlab's job output I see the following:
$ jekyll build -d public
...
Bundle complete! 5 Gemfile dependencies, 29 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-musl]
Configuration file: /builds/TheOddler/mjb/_config.yml
Source: /builds/TheOddler/mjb
Destination: /builds/TheOddler/mjb/public
Incremental build: disabled. Enable with --incremental
Generating...
Error: YAML Exception reading /builds/TheOddler/mjb/_work/immaculate.md: (<unknown>): did not find expected key while parsing a block mapping at line 2 column 1
Jekyll Feed: Generating feed for posts
done in 1.104 seconds.
Auto-regeneration: disabled. Use --watch to enable.
Uploading artifacts for successful job 00:09
Uploading artifacts...
So it shows Error: YAML Exception ... but then still continues as if everything is OK.
The job in my .gitlab-ci.yml file looks like this:
build-jekyll:
stage: build
image: jekyll/jekyll:4.2.0
script:
- jekyll build -d public
artifacts:
paths:
- public
only:
- master
Why does this happen? And is there a way to make the process fail, or at least report this as a warning so I know something went wrong?
Thanks!
This happens because Jekyll, dispite the error in the output, returns with exit code 0. You could try to add the --strict_front_matter option to let Jekyll return a non-zero exit code.

jekyll serve throws 'no implicit conversion of Hash into Integer ' error

I am following Michael Hartl's Learn Enough CSS course. My current folder layout is as follow:
- _layouts
- _site
index.html
where index.html is:
---
layout: test
---
and I have test.html in _layouts as:
Hello again, world.
Whenever I run jekyll serve, I get this error:
Error reading file /Users/pj/Documents/LETGD/repos/pohjie.github.io/_layouts/test.html: no implicit conversion of Hash into Integer
Error reading file /Users/pj/Documents/LETGD/repos/pohjie.github.io/index.html: no implicit conversion of Hash into Integer
Does anyone have any idea what's happening? I'm using M1 MacBook, not sure if that is a possible cause as I spent a lot of time install Ruby as well.
Thanks!
While downgrading certainly works, it may be pretty annoying and (depending on where you need this) problematic. If you just want a simple workaround, you can make use of the fact that jekyll build still works with Ruby 3 and just serve the page separately:
bundler exec jekyll build && bash -c 'cd _site && python -m http.server 3000'
The only downside of this is that you lose the automatic reload. If you change anything, you need to restart jekyll. But you can run this in a Ruby 3 environment without fiddling with the environment itself.
Quoting from this source:-
Github-Pages uses Jekyll 3.9, which isn’t compatible with Ruby 3.
Downgrading to Ruby 2.7 should avoid the problem.
This worked for me.
Downgrading to Ruby 2.7 is an option (as others have said) which I didn't feel like doing, so I did this instead:
Apply the patch to pathutil
From Liviu Stefan's answer:
Ruby 3.0 deprecated using the last argument as keyword parameters. A double splat ** has to be added before the variable for the behavior to be supported.
Here's how I applied the patch locally:
sudo sed -i.bak 's/, kwd/, **kwd/' $(gem which pathutil)
After that I got another error:
/var/lib/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
Which I fixed by running (from bundle exec jekyll serve: cannot load such file):
bundle add webrick
Ruby 3.0 deprecated using the last argument as keyword parameters. A double splat ** has to be added before the variable for the behavior to be supported.
It's fairly straightforward to amend locally; the relevant patch is found: here
Which needs to be applid to:
/home/<your_user_name>/gems/gems/pathutil-0.16.2/lib/pathutil.rb

How to solve Jekyll-Include-Cache issue?

I am currently trying to open an already created website made through Jekyll. I use the cd command through the terminal to get to the website file that I pulled from Github. Once I get to the file, I run bundle exec Jekyll serve and it shows this error message:
Dependency Error: Yikes! It looks like you don't have Jekyll-include-cache 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-include-cache' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
Jekyll 3.8.5 | Error: Jekyll-include-cache
So I then do gem install Jekyll-include-cache and the issue remains. Does anyone know how to fix this??
The error message means that Jekyll couldn't load the plugin properly.
Ensure that you have listed the plugin in your Gemfile:
# Gemfile
gem "jekyll-include-cache"

Jekyll serve didn't work: It looks like you don't have pygments or one of its dependencies installed

Configuration file: /Users/andrechristoga/Documents/type-theme/_config.yml
Deprecation: You appear to have pagination turned on, but you haven't included the `jekyll-paginate` gem. Ensure you have `gems: [jekyll-paginate]` in your configuration file.
Source: /Users/andrechristoga/Documents/type-theme
Destination: /Users/andrechristoga/Documents/type-theme/_site
Incremental build: disabled. Enable with --incremental
Generating...
Dependency Error: Yikes! It looks like you don't have pygments 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 -- pygments' If you run into trouble, you can find helpful resources at http://jekyllrb.com/help/!
Liquid Exception: pygments in /Users/andrechristoga/Documents/type-theme/_posts/2014-11-28-markdown-and-html.md
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
pygments
These are the message when I type jekyll serve.
I had the same issue but fixed it installing pygments gem.
gem install pygments.rb
And adding it to my Gemfile.
gem 'pygments.rb'
if you are a windows user, you could run CLI as administrator. This would help.
If you use the command sudo gem install pygments.rb or gem install pygments.rb, it may not works
So you can try root:
su root
gem install pygments.rb
This fix my problem.

Jekyll serve -w Issue

I am using the jekyll with git-hub-pages on Win7, however no matter what I do the
jekyll serve --watch or
jekyll serve -w
won't start the server (the jekyll serve is working fine).
the produced error has something to do with
custom_require.rb:36 - cannot load such a file --wdm
How can I fix it?
As shown in the error message, wdm is not found.
First, update your gems
gem update
Then, manually install wdm
gem install wdm