run jekyll --server failed in win7 - jekyll

when i run jekyll --server,it built failed ,and display this :
[2013-01-10 15:34:52] regeneration: 1 files changed
Liquid Exception: Failed to get header. in 2013-01-05-vim.markdown
C:/Ruby193/lib/ruby/gems/1.9.1/gems/pygments.rb-0.3.7/lib/pygments/popen.rb:357:
in rescue in get_header'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/pygments.rb-0.3.7/lib/pygments/popen.rb:338:
inget_header'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/pygments.rb-0.3.7/lib/pygments/popen.rb:235:
in block in mentos'
C:/Ruby193/lib/ruby/1.9.1/timeout.rb:68:intimeout'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/pygments.rb-0.3.7/lib/pygments/popen.rb:209:
...
i use pygments to highlight my code..
help me !!

Check if your python version is 2.X. Python 3 is unsupported by the pygments.rb gem.

This is giving me headache...: since 2011 it seems that "pygments.rb" is reported to work with Python 3 as per this Jekyll installation guide for windows mentioned in the official Jekyll installation docs "http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html" (which just to blow in more confusion today got an expired domain...)
So yea, how do you install Jekyll, which by the way is described as a Ruby static website generator on its github page - when it:
requires Python while being a Ruby thing
recommends Python 3 leaving you alone to figure out that it only works with Python 2
doesn't say a thing about it after 2 years
Well you simply don't.

Related

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

jekyll_lunr_js_search.rb or one of its dependencies installed once switched code to windows from ubuntu

On Ubuntu v15 my Jekyll Blog with jekyll lunr-js-search builds well as well as it gets build in gitlab-ci.
Now, I moved my project to Windows system with same versions of node, bower etc. I get following error on windows as well as gitlab-ci (This error repeated on gitlab-ci when I've made only a single line change in post). HOW TO FIX ?
ERROR
Dependency Error: Yikes! It looks like you don't have /builds/sachingpta/home/_plugins/lunrjs/jekyll_lunr_js_search.rb 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 -- v8' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
It got built on gitlab, it could be due to gitlab update with dashboard message: We're currently deploying 8.17.0 RC2, so you may encounter intermittent errors. Somebody mentioned that required dependency therubyracer does not compiles on windows so this question is closed. I've to compile project on ubuntu only :(

Getting ExecJS::ProgramError following GettingStarted guide while trying to change the basic application homepage

I'd like to make sure you pay attention that the error is not in the javascript line, it's in marked at the line containing the stylesheet link tag!
I was following this guide:
http://guides.rubyonrails.org/getting_started.html
I get to part 4.3 Setting the Application Home Page
I've done everything up to this point, used the generate command to make a new controller and a view named "Welcome".
I've changed the app/views/welcome/index.html.erb content to a simple <h1>Hi</h1>, and then added a line in config/routes.rb which made it look like this
Rails.application.routes.draw do
get 'welcome/index'
root 'welcome#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
After saving those modifications, going to localhost:3000 gives me the following error:
I am using rails 5.0.1 and ruby 2.3.3 in case anyone asks
UPDATE:
I found a thread on some forum in German that seems to be dealing with the same problem. The person there suggested to modify the gemfile and add:
gem 'coffee-script-source', '1.8.0'
as well as run this command:
bundle update coffee-script-source
I've tried this but to no avail, it cannot execute the command(system cannot find the path specified).
What is going on?
I've managed to come up with a solution after a lot of failed attempts and frustration.
Apparently, the default runtime doesn't work properly with ruby on rails in windows. What fixes the error is installing the node.js runtime.
Download and install the node.js javascript runtime and don't forget to turn off your server and run it again before visiting the site again.
Cheers!
try to uncomment ruby-racer gem in Gemfile and run bundle.

Linking errors while building VTK

I am trying to build ITKapps. I am using ITK 4.7., ITKapps 4.7. FLTK 1.1.3.
Some applications build ok, there is .exe and I can run them.
While building applications which use VTK always linking errors appears: cannot find vtkRendering.lib or vtkRenderingOpenGL.lib...
Problem is that I cant build VTK either. While building VTK there are also linking errors:
Error 3808 error LNK1104: cannot open file '......\bin\Debug\vtkRendering.lib'
I tried VTK 4.x and 5.x.. and not one version builds successfull.
VTK 6.x builds ok but building ITKapps still have linking errors.(i don't think ITKapps works with VTK 6.x) so i must use version 4 or 5.
Maybe someone have idea what am I doing wrong or some sugestions?
I had the same error, error LNK1104: cannot open file '......\bin\Debug\vtkRendering.lib' while trying to build VTK in VS 2012. In Cmake I changed the VTK_RENDERING_BACKEND value from OpenGL to OpenGL2 and later the build succeeded in VS.

Can't get JRuby to work on AIX machine

I looked everywhere and I can't find any help on how to get JRuby to work on AIX. I tried unpacking the binary package, tried using the jruby-complete.jar but I stumble on the same problems.
All errors seem to occur because JRuby is looking in the wrong directories for lib files.
For instance, I set my GEM_PATH=/home/dev999/install_tmp/gem and then I try to require activerecord-jdbc-adapter, which is installed under ./gem/gems/activerecord-jdbc-adapter-1.3.12, but for some reason JRuby keeps looking for the gem under ./gem/gems/activemodel-4.1.8/lib as shown below.
dev-host:/home/dev999/install_tmp$ jruby -e "require 'activerecord-jdbc-adapter'"
Errno::ENOENT: ENOENT - /home/dev999/install_tmp/gem/gems/activemodel-4.1.8/lib/activerecord-jdbc-adapter
file? at org/jruby/RubyFileTest.java:131
contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:46
any? at org/jruby/RubyEnumerable.java:1473
contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:46
any? at org/jruby/RubyEnumerable.java:1473
contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:44
find_inactive_by_path at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/specification.rb:898
find at org/jruby/RubyEnumerable.java:592
find_inactive_by_path at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/specification.rb:897
try_activate at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems.rb:183
require at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:132
(root) at -e:1
Any insights on what may be causing this are greatly appreciated.
EDIT: The server is an AIX 64 bits; we tried Java 1.6 and 1.7 both 64 and 32 bits (IBM custom build for AIX) but we ended up sticking with 1.7 64 bits in the final solution, although the version doesn't seem to affect the issues found in the Ruby 1.7.9 installation, but since we couldn't get JRuby 1.7.16 to work, I can't be sure if the Java builds we used could have played part in the problem.
OK, so the server admin and I spent two days trying to figure these things out and I can finally summarize the solution we ended up with to get JRuby working on AIX_64.
1 . First and most important of all, I had to install JRuby 1.7.9 since the 1.7.16 stable version from the main download page in jruby.org has many (seemingly AIX specific) bugs that we could not figure out; for instance, the wrong gem path resolution shown in my original question. Version 1.7.9 sorts out most of the issues automatically;
2) For some weird reason that I'm still unable to figure out, jirb won't work with the jline-2.11.jar lib that comes with the downloaded JRuby package. At some point I got it to work but then I could not retrace my steps so I gave up. To sort this issue out I downloaded jline-1.0.jar and replaced the jline jar located under <jruby_path>/lib/ruby/shared/readline/jline-2.11.jar; please note that even if we are replacing this with jline-1.0, the jar file name must still be the same i.e. jline-2.11.jar otherwise jirb will complain about a missing lib;
3) Some common steps: add jruby/bin to $PATH; make sure which java shows the correct Java version you want to use; set $JAVA_HOME;
4) (Optional, but very useful) in order to avoid having to grant my user write access to the /usr/<jruby>/<gem_paths> directories but still allow me to install gems without having to ask the admin I added export GEM_PATH=~/.gem to my .profile, then mkdir ~/.gem. To install gems to my home directory I do jgem install <gem_name> -i $GEM_PATH.
Hopefully this helps other users struggling with the same problems.
My main suggestion is to join the jruby mailing list and ask there. I've used jruby just once and managed to get it working. Here is a bit of magic that I don't really understand that I have at the top of one of the first files I require:
# We need the db2j.jar loaded
require 'db2j.jar'
# Some feaking magic Java needs
Java::JavaClass.for_name 'com.ibm.db2j.jdbc.DB2jDriver'
# The connection string is jdbc:db2j:the/path/to/the/file where the
# file is actually a directory.
CloudscapeDriver = 'jdbc:db2j'
You can see the email thread here: http://comments.gmane.org/gmane.comp.lang.jruby.user/17856
good luck