jekyll serve isn't working for dependency error - ruby

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

Related

Installing and running jekyll on Windows 10

I tried Github pages on Friday and found it great so decided to install Jekyll locally (Windows 10) so I could build and test offline. After spending almost a day and trying multiple recipes (from theserverside.com, jekyllrb.com, etc) for how to install Jekyll I finally got jekyll -v to work. (Note that the instructions I found weren't bad but probably just out of date. People need to updates their blogs, or better people should stop changing how things are set up!)
However, now when I try to serve a test site I get a Segmentation fault (as below). I have tried starting again from scratch several times and even strangely get different results but have never gotten as far as serving the site.
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]```
$ jekyll -v
jekyll 4.2.2
$ jekyll new myblog
...
$ cd myblog
$ bundle exec jekyll serve
Configuration file: e:/Work/tmp/Daily/blog/myblog/_config.yml
Source: e:/Work/tmp/Daily/blog/myblog
Destination: e:/Work/tmp/Daily/blog/myblog/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]
-- Control frame information -----------------------------------------------
c:0033 p:---- s:0182 e:000181 CFUNC :compile_data_context
c:0032 p:0314 s:0177 e:000176 METHOD C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43
...
[+576 more lines of backtrace and runtime info - available on request]
Thanks for any help you can give me to get Jekyll working.
BTW I don't like to complain but getting Ruby and Jekyll installed and running has been a royal pain. Maybe I have been spoilt with Go which literally took less than 10 minutes to install and have a running program (though calling C from Go (using CGO) took me a few hours to get working). Moreover, if Jekyll was written in Go it would a simple matter of downloading a single jekyll.exe - ie a few minutes instead of days (or however long it takes to get this working).
Update: I have tried lots of things with varying results but I never get as far as Jekyll serving the site. I don't know enough about Ruby and/or understand what the error messages mean to try to fix these things so I have now taken to documenting exactly what I tried and the result. Here are the last 4 things I tried and the result:
================================
Using Ruby 3.1.2.1 + Devkit (x64) and following instructions at https://jekyllrb.com/docs/installation/windows/ which run without error but then serving a test site has an error:
$ jekyll -v
jekyll 4.2.2
$ jekyll new myblog
...
New jekyll site installed in D:/myblog.
$ cd myblog
$ bundle exec jekyll serve
Configuration file: D:/myblog/_config.yml
Source: D:/myblog
Destination: D:/myblog/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
done in 1.829 seconds.
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
Auto-regeneration: enabled for 'D:/myblog'
------------------------------------------------
Jekyll 4.2.2 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/servlet.rb:3:in `require':
cannot load such file -- webrick (LoadError)
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:179:in `require_relative'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:179:in `setup'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:100:in `process'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `each'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-4.2.2/exe/jekyll:15:in `<top (required)>'
from C:/Ruby31-x64/bin/jekyll:32:in `load'
from C:/Ruby31-x64/bin/jekyll:32:in `<main>'
=======================================
Using Ruby 3.1.2-1 and following instructions at https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/jekyll-install-windows-example-blog-tutorial after a lot of trial and error I eventually got jekyll serve to run but it said "generating feed" then stopped and there was no server running at http://localhost:4000.
=======================================
Using Ruby 3.0.4-1 (x64) and following instructions at https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/jekyll-install-windows-example-blog-tutorial I get to the very end but when I try to serve the a test site I get:
$ bundle exec jekyll serve
Configuration file: D:/myblog/_config.yml
Source: D:/myblog
Destination: D:/myblog/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
done in 0.758 seconds.
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
Auto-regeneration: enabled for 'D:/myblog'
------------------------------------------------
Jekyll 4.2.2 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
...
===================================
Using Ruby 2.7.0.1 and following instructions at https://gist.github.com/arthurattwell/281a5e1888ffd89b08b4861a2e3c1b35 I get as far as the ridk install and which fails:
$ ridk install
...
Which components shall be installed? If unsure press ENTER [1,2,3]
> sh -lc true
MSYS2 seems to be properly installed
Remove catgets to avoid conflicts while update ...
> pacman -Rdd catgets libcatgets --noconfirm
error: target not found: catgets
error: target not found: libcatgets
MSYS2 system update (optional) part 1 ...
> pacman -Syu --needed --noconfirm
:: Synchronizing package databases...
mingw32 is up to date
mingw64 is up to date
ucrt64 is up to date
clang32 is up to date
clang64 is up to date
msys is up to date
:: Starting core system upgrade...
there is nothing to do
:: Starting full system upgrade...
there is nothing to do
MSYS2 system update (optional) succeeded
MSYS2 system update (optional) part 2 ...
> pacman -Su --needed --noconfirm
:: Starting core system upgrade...
there is nothing to do
:: Starting full system upgrade...
there is nothing to do
MSYS2 system update (optional) succeeded
Install MSYS2 and MINGW development toolchain ...
> pacman -S --needed --noconfirm autoconf autoconf2.13 autogen automake-wrapper automake1.10 automake1.11 automake1.12 automake1.13 automake1.14 automake1.15 automake1.6 automake1.7 automake1.8 automake1.9 diffutils file gawk grep libtool m4 make patch pkg-config sed texinfo texinfo-tex wget mingw-w64-x86_64-binutils mingw-w64-x86_64-crt-git mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-headers-git mingw-w64-x86_64-libmangle-git mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-tools-git mingw-w64-x86_64-winpthreads-git
error: target not found: automake1.10
error: target not found: automake1.6
error: target not found: automake1.7
error: target not found: automake1.8
error: target not found: automake1.9
warning: file-5.41-4 is up to date -- skipping
warning: gawk-5.1.1-1 is up to date -- skipping
warning: grep-1~3.0-3 is up to date -- skipping
warning: sed-4.8-3 is up to date -- skipping
warning: wget-1.21.3-1 is up to date -- skipping
Install MSYS2 and MINGW development toolchain failed
Installation failed: pacman failed
I got it to work using the instructions at www.theserverside.com and installing Ruby 2.7.6
Note that the install of Ruby messed with msys/mingw and now when I try to debug my Go program I get this error:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../lib/libmsvcrt.a(/359): duplicate symbol reference: _unlock_file in both libgcc(.text) and libgcc(.data)
libgcc(.text): relocation target ___chkstk_ms not defined
libgcc(.text): relocation target atexit not defined
but I guess that is a new question

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."

jekyll-multiple-languages-plugin cannot be found

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.

Running Jekyll Serve on Debian Chromebook

I am working on a Chromebook, where I have setup a debian chroot.
I ran the following commands with no problems:
$ gem install jekyll
$ jekyll new myblog
$ cd myblog
When running:
~/myblog $ jekyll serve
I receive the following error:
/home/damon/.rvm/gems/ruby-2.2.0/gems/liquid-2.6.1/lib/liquid/htmltags.rb:43: warning:
duplicated key at line 46 ignored: "index0"
Configuration file: /home/damon/myblog/_config.yml
Source: /home/damon/myblog
Destination: /home/damon/myblog/_site
Generating...
Liquid Exception: Failed to get header. in _posts/2014-12-28-welcome-to-jekyll.markdown
jekyll 2.5.3 | Error: Failed to get header.
I have tried changing Ruby versions from 2.2 and 1.9.
Does anyone have an idea one how to resolve this issue?
Please let me know if you need any further information.
Most likely you haven't installed Python 2.7.3 - Do not install Python 3 since Pygments (the highlighter) doesn't support Python 3. See related Github Issue here.
A re-install of Python can also fix it.

Problems running rails 2.3.10 bundler `require': no such file to load -- rubygems (LoadError)

I have an app on Rails 2.3.10 on production; when I try to start with ruby script/server -p 3017 -e production -d it throws me the following error:
Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
try installing passenger to start the project with but it generates another error:
/home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/shared_helpers.rb:2:in `require': no such file to load -- rubygems (LoadError)
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/shared_helpers.rb:2
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/setup.rb:1:in `require'
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/setup.rb:1
I got this project from another developer, and he always started the project this way; before it didn't have a Gemfile, so I created a Gemfile where I defined the gems the project is using and then install everything with bundler adding the parameter --deployment:
bundle install --deployment
I've also followed the steps that are on the official website of bundler:
http://bundler.io/v1.3/rails23.html
But when I try to run the project the same way using ruby script/server it haves me the same error. I followed this threads but none of them worked for me:
http://docs.rubygems.org/read/chapter/15#page66
Rails "no such file to load -- rubygems (LoadError)"
no such file to load -- rubygems (LoadError)
What can I do? Thanks in advance.
Juan Trejo.
I have run into similar issues. Try running
rvm gemset use global && bundle

Resources