jekyll commands output some failure - jekyll

I have something wrong with my jekyll installation. After typing however jekyll command in terminal, it outputs following:
/usr/lib/ruby/vendor_ruby/jekyll/converters/sass.rb:6:in
<module:Converters>': uninitialized constant Jekyll::Converters::Scss (NameError)
from /usr/lib/ruby/vendor_ruby/jekyll/converters/sass.rb:5:in ...'
Anyone knows what's wrong? I have no idea. Thanks

You can try to gem update or bundle update. This seems to be an old bug.

I had this problem with jekyll on Ubuntu 14.10. It's been fixed in Debian, and reported as a bug in Ubuntu. You can manually apply the same fix, it's just one line (see patch) that needs to be added to a file:
Open /usr/lib/ruby/vendor_ruby/jekyll/converters/sass.rb
Add require 'jekyll/converters/scss' at the top, just after require 'jekyll/utils'
Also make sure that the package ruby-mercenary is installed (sudo apt-get ruby-mercenary), because of another bug.
Then Jekyll will work. Alternatively, use Rubygems: gem install jekyll.

Related

Error installing "nokogiri" in a Ruby on Rails application?

I've been following along with the Lynda.com's Ruby on Rails course. I did everything just as mentioned inside the videos.
I am trying to run the rails server command, which should default to WEBrick, correct?
I run the command and it has an issue in the nokogiri.rb file and on line 29 where the error is happening this is what is read:
require 'nokogiri/nokogiri'
Which is what my command prompt is throwing up on when running the rails server command. Any idea what could be causing this? If so, what commands do I need to run to settle this? To me it sounds like something was missed when installing MySQL.
I am not sure what nokogiri is and why rails server won't run and points to that line of code.
The path to this file is (Wherever you installed the folder to)\lib\ruby\gems\2.2.0\gems\nokogiri-1.6.6.2-x64-mingw32\lib
EDIT**: I have a chain of errors, like it goes from -long path-, from -longpath- etcetera. I tried installing the latest gem, and it wasn't successful. Is there a log file I can get to share with you guys to help figure out the issue.
nokogiri is a Ruby "gem" (library) for parsing XML and HTML.
Your Rails project should have a Gemfile which specifies the name and version of each gem needed to run the project. To install the gems listed in the gemfile:
bundle install
After that install completes successfully, Rails should be able to find the nokogiri gem.
Try this
$ sudo apt-get install libxslt-dev libxml2-dev zlib1g-dev
$ sudo gem install nokogiri -v '1.5.11'
According to \lib\ruby\gems\2.2.0\gems\nokogiri-1.6.6.2-x64-mingw32\lib, which means that you are running it on Windows platform. You are using ruby 2.2.0.
I know that nokogiri conflicts with 2.2.* versions of ruby in Windows. I have already encountered this problem. I think it is because of mingw32.
You need to install 2.1.* version of Ruby in order to make Nokogiri work.

Jekyll install on Windows error message

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.

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

Problem deploying Rails 3 with Passenger: missing the mysql gem

I have a problem that seems very related to that in another post, but I don't understand the solution that was arrived at. I am new to Rails, and have put together a Rails 3 app. I am developing in Windows am trying to deploy it to my (shared) Redhat Linux server via git and capistrano, and using Passenger to serve the pages. The deployment process goes fine, but when I try to look at the webpage I get a Passenger error:
!!! Missing the mysql gem. Add it to your Gemfile: gem 'mysql', '2.8.1'.
In fact, I have added the corresponding line to my Gemfile, and doing a 'gem list' on the server shows that it is there.
In this post, the user helpfully noted exactly the same problem and observed that the Gemfile.lock has the gem for Windows, i.e.
mysql (2.8.1-x86-mingw32).
This is exactly the same in my Gemfile.lock, and so I imagine the same issue is happening for me; one can see that this is the gem in vendor/cache and vendor/bundle.
However, I don't understand how the proposed fix from that post is supposed to work. I can edit the mysql line in Gemfile.lock to be mysql (2.8.1), but then I get a different Passenger error that says
Can't find mysql-2.8.1 in any of the sources.
How can I fix this?
In case someone encounters the same problem, here are some things I did that made it work. I don't understand enough of what was going on to know exactly what did the trick.
First, in the Gemfile, I specified that we wanted both ruby and windows versions of the relevant gems.
gem 'sqlite3-ruby', "~> 1.2.5", :platforms => [:mswin, :ruby_18]
gem 'mysql', "2.8.1", :platforms => [:mswin, :ruby_18]
Then on the production server, after using "cap deploy", I removed the gem mysql-2.81-x86-mingw32 from both vendor/bundle and vendor/cache. My production server lets me 'gem install mysql' and 'gem install sqlite3-ruby' but puts it elsewhere in my home directory; I copied these into vendor/bundle and vendor/cache. I edited the Gemfile.lock to change the line 'mysql (2.8.1-x86-mingw32)' to 'mysql (2.8.1)'. 'bundle install' on the production server then seems to install the linux native gems (at least it says 'building native extensions').
After all this, it seems to work.
Run the command bundle install. I'm sure this will fix your issue.
Also, do not edit or move over the Gemfile.lock. Let bundler take care of that.