Jekyll install on Windows error message - jekyll

I think I'm just at the finish line for installing jekyll on windows, It's connecting fine, but I'm getting an error message:
Liquid exception: No such file or directory - python C:/Ruby193/lib/ruby/ms/1.9.1/gems/pygments.rb-0.6.3/lib/pygments/mentos.py in _posts/2015-06-09-welcome-to-jekyll.markdown<-[0m done.
Please add the following to your Gemfile to avoid polling for changes: gem 'wdm','>=0.1.0' if Gem.win_platform
I'm not sure what messages I can ignore and what I need to fix. What do you guys think?
If adding this to my gemfile is as simple as entering a cmd prompt, what do I need to enter to install it?

This was an issue that was addressed by me by another question a few days ago.This is the original question and my answer.
Basically the issue here is that you need to install Python to use Jekyll on Windows because the code highlighter Pygments is written in Python, hence requires Python to function. Pygments is alsothe default code highlighter currently. In the future versions of Jekyll will use the Rouge highlighter, which is written completely in Ruby. This issue is tracked on GitHub.
To solve your current problem, you just need to install Python 2.x, which the official linked guide from the Jekyll documentation provides very clear instructions there. You will also need to install pip. I have also included alternatives in the other SO answer I have given, so I will just provide you the link to it to reduce duplicate information and copy-paste.
Once you have Python 2.x and pip set up, and install pygments, your Jekyll install should be up and running with the site template!
Regarding the Gemfile
A summary of what a Gemfile is: A file that lists all the required Ruby gems for a particular program. For example, you wrote a ruby program that depends on 10 other gems, rather than ask the user of your new gem to go download the previous 10 gems, and then later wrestle with outdated gem issues, a Gemfile is used to keep track of what gems are needed and version. The Gemfile is used by Bundler, which is also a gem that automatically keeps track of what gems you need. In the case of Jekyll, you can use a Gemfile to dictate what you want added into your Jekyll install or removed. This is used by GitHub to keep local versions of Jekyll and other gems updated with the version used by Github Pages.
As for that notification, all you would need to do to avoid polling for changes is:
Open notepad or text editor of choice.
Add this line: gem 'wdm','>=0.1.0' if Gem.win_platform, just that line of text. You can later add gems by typing in gem 'nameOfGem in a separate line.
Save the file as Gemfile in your Jekyll site's folder. Notice that there is not .txt extension, which you can create a file with no extension in notepad by choosing 'All Files' instead of '.txt' under 'Save As'. Or, you could just edit the file extension to remove the .txt.
Install bundler by executing gem install bundler.
Run bundle install to update the gems. If you're using GitHub, add the Gemfile and the newly generated Gemfile.lock into git.

Related

copy jekyll remote theme to local

I just noticed that jekyll has all it needs installed locally, but a remote-theme is fetched every time jekyll is started.
I've also seen that people proposed a cache extension which hasn't been merged yet.
So I wonder if it is possible to just clone the remote theme to a certain folder?
ok, found the solution:
most themes are available also as ruby gems. So instead of specifying a remote-theme, I add the corresponding gem to Gemfile
gem "minimal-mistakes-jekyll"
and then reference it in the _config.yml
theme: minimal-mistakes-jekyll

How do I install one of Github Pages' Jekyll themes for local preview?

I'm trying to install Github Pages' Slate theme on my CentOS 7 VM so I can locally preview my new site using the bundle exec jekyll serve command.
I followed the instructions as best as I could.
I changed the theme minima to jekyll-theme-slate in my _config.yml file.
Then I changed gem "minima", "~> 2.0" to gem "github-pages", group: :jekyll_plugins in my Gemfile file.
After that (since these are their only instructions), I ran bundle exec jekyll serve and it told me I had gems that weren't installed (duh), and suggested running bundle install.
I ran bundle install, which told me there was a conflict in version types of the dependencies and it suggested that bundle update could potentially resolve that issue.
No problem, I ran bundle update. A few plugins/features actually reverted versions here, but I got the Slate theme installed on my machine now, version 0.0.4 for whatever reason.
After that, I ran bundle exec jekyll serve again. I got this error:
Configuration file: /home/peri/my-site/_config.yml
Configuration file: /home/peri/my-site/_config.yml
jekyll 3.4.3 | Error: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
In a way, that error makes sense. For a custom theme to work, I probably need a tool to run their custom scripts. But first, I noticed this extra section in the theme's installation instructions, which directly mentions being able to locally preview the site with that theme.
I downloaded the source, instead of cloning it...I don't need the .git stuff do I?
I edited the script/bootstrap file because /usr/local requires root and using sudo doesn't know about any binary called gem or bundle. I changed gem and bundle to their respective absolute paths and ran sudo ./script/bootstrap inside of slate-master.
Point of the story is, it didn't work for my home/peri/my-site directory when I ran bundle exec jekyll serve. Presumably, it's because they intended for the user's site to be integrated into their theme's source code? That doesn't seem intuitive or correct. So, I investigated ExecJS.
I installed it. gem install execjs
I added gem "execjs", "2.7.0" to my Gemfile file.
Got the same error as before.
How am I supposed to install this Jekyll theme?
Follow these steps after changing the theme in _config.yml:
Gemfile should have only this content:
source "https://rubygems.org"
gem "github-pages"
remove bundler current config: rm -r .bundle/
remove Gemfile.lock: rm Gemfile.lock
Install local dependencies in an isolated folder just for this website: bundle install --path=vendor/bundle
You won't have post and page and home themes, you will need to use just default in all your posts.
Generate and run server: bundle exec jekyll s

"jekyll serve --watch" doesn't regenerate automatically

I'm working locally on a website that was build with Jekyll, and watching doesn't auto-regenerate changes I do in the code.
jekyll 2.2.0
ruby 2.1.1p76 via rvm
configuration file I use is default one from http://jekyllrb.com/docs/configuration/
Any suggestions? Thanks!
UPDATE #1: looks like something wrong in other area (gems? node.js?). Another project with Compass also unwatchible at the moment.
UPDATE #2: problem was solved after installation of "listen" gem.
You can often solve issues like this by using a Gemfile with bundle exec to ensure that all necessary gems are installed. Try putting the gems you need into a Gemfile, and then run bundle exec jekyll serve --watch to only use those gems.
Note: This answer is based off my previous comment.
In my case after experimenting with different combinations of versions of Ruby and Jekyll, I figured out that I don't have a "listen" gem. After installation of it auto regeneration works well.

Just started ROR Lynda Tutorial, Error while trying to execute rails server

Just started ROR Lynda Tutorial, Error while trying to execute the rails server in terminal.
New to ROR. Followed tutorial closely and installed all necessary gems and files. Creating a simple CMS. However I'm stuck with the following error.
$ rails server
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#each called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
Could not find gem 'mysql2 (~> 0.2.6)' in any of the gem sources listed in your Gemfile.
I have installed MySQL server version 5.5.13. I have Rails version 3. I have the MySQL(0.3.2) gem file installed. Any help would be appreciated. Thanks
The best way to fix this is to run
gem pristine --all
This rebuilds the Gems and should get rid of the error for you.
From the error I see that most likely your setup is not right. You should do a 'bundle check' to see if all dependencies have been met, I am quite sure they haven't. If you haven't yet done a 'bundle install' you need to do so, if you've done that already, then the problem is that bundler wasn't able to install mysql2 gem version 0.2.6 (it must be mentioned somewhere either in you Gemfile or somehow in the Gemfile.lock in case you've got that from somewhere else). So you would then either bundle install will fix it, or if not, then you should probably do a 'bundle update mysql2'

Ruby mysql2 gem, cannot build on Windows 7

I come from OSX where Ruby runs super flawlessly 90% of the time. I haven't touched it in awhile though and happen to be working on a Windows 7 machine right now. I'm trying to run a simple Ruby on Rails project but I can't seem to get past any of my database setup.
I want to run on mysql but when I try to install the mysql2 gem (via bundle install or gem install mysql2) I get these errors:
Installing mysql2 (0.2.9) with native
extensions
C:/Ruby192/lib/ruby/site_ruby/1
.9.1/rubygems/installer.rb:533:in
`rescue in block in build_extensions':
ERROR: Failed to build gem native
extension.
(Gem::Installer::ExtensionBuildError)
C:/Ruby192/bin/ruby.exe extconf.rb checking for
rb_thread_blocking_region()... *
extconf.rb failed * Could not create
Makefile due to some reason, probably
lack of necessary libraries and/or
headers. Check the mkmf.log file for
more details. You may need
configuration options.
I'm pretty much a complete newb when it comes to this kind of thing so if anyone has any advice, please help!
To install and compile extensions sometimes you need libraries and headers of the dependencies. In this case, you need MySQL headers and libraries to properly compile.
Assuming you downloaded Ruby from RubyInstaller and also installed the Development Kit and followed it's installation instructions, to successfuly install mysql2 gem I recommend you read this answer in our Troubleshooting page:
Download MySQL Connector/C
Extract into a path without spaces
When installing mysql2 gem, provide the additional options (gem install mysql2 -v 0.2.10 -- --with-mysql-include=... --with-mysql-lib...)
Provide for --with-mysql-include option the path to the include directory of MySQL Connector/C. The same for --with-mysql-lib but this time point to lib directory.
Don't forget to copy libmysql.dll to your Ruby bin directory.
Hope this helps.
The problem with native extensions on Windows is that there are two different compiler infrastructures: one based on MS VC and its Visual Studio and one based on MinGW (Minimalist GCC for Windows).
There are Ruby native extensions that can be compiled with any of them and other, that only support one. And since most of them come from some kind of Unix, chances are that mingw works better that MSVC.
So you may try to install mingw and use it to compile mysql gem - there is a special package called devkit, which contains a minimal necessary mingw installation which you just put inside your ruby installation.
I had a success compiling several native extensions using devkit: eventmachine, linecache, bson-ext to name a few. And within devkit you will feel much more are home :-) (coming from OSX)
If you have the devkit setup correct as #Tomasz mentions, please make sure you check the compatibility of mysql2 gem version with windows, I have experienced in the past for it to cause issues and had to go and install a previous version to get it working. Last I remember v0.2.6 was the version that supported windows.