Github-Pages error running Jekyll Locally - ruby

I am trying to run my Github-pages website locally. I have it running on another machine that is using Ruby 2.1.0 on Windows x64. Today I wanted to run locally on my home machine that is running Ruby 2.2.0. I pulled my repo locally, ran bundle install after a few issues with nokogiri I was able to get through a clean bundle install. I then proceeded to run the command bundle exec jekyll serve -w. Upon running this command I receive the following errors:
/Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander 4.1.6/lib/commander/runner.rb:385:in block in require_program': program version required (Commander::Runner::CommandError)
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/runner.rb:384:in `each'
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/runner.rb:384:in require_program'
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/runner.rb:52:in run!'
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/delegates.rb:8:in run!'
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/import.rb:10:in block in <top (required)>'
/Users/<me>/.rvm/gems/ruby-2.2.0/gems/safe_yaml-1.0.3/lib/safe_yaml/load.rb:43:in <module:SafeYAML>': undefined method tagged_classes' for Psych:Module (NoMethodError)
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/safe_yaml-1.0.3/lib/safe_yaml/load.rb:26:in <top (required)>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/safe_yaml-1.0.3/lib/safe_yaml.rb:1:in require'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/safe_yaml-1.0.3/lib/safe_yaml.rb:1:in <top (required)>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/jekyll-1.5.1/lib/jekyll.rb:21:in require'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/jekyll-1.5.1/lib/jekyll.rb:21:in <top (required)>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/jekyll-1.5.1/bin/jekyll:7:in require'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/jekyll-1.5.1/bin/jekyll:7:in <top (required)>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/bin/jekyll:23:in load'
from /Users/<me>/.rvm/gems/ruby-2.2.0/bin/jekyll:23:in <main>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in eval'
from /Users/<me>/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in <main>'
I'm beginning to believe that this issue is not to do with my setup but with an incompatibility with jekyll on ruby 2.2.0. Any help would be appreciated.
Thank you!

So after some more digging I was missing a simple step. After running the command bundle install I needed to run bundle update. Once I did this the version of jekyll and other dependencies was brought up to the correct version and I was then able to run my bundle exec jekyll serve -w command without any errors.
This seems strange that the initial install command would not install the latest version.

Related

capistrano suddenly stopped working

i'm using a ubuntu vagrant box with installed capistrano to develop an application.
when i tried to deploy i get the following error:
/usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:152:in `require': no such file to load -- capistrano/ext/multistage (LoadError)
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:152:in `require'
from ./config/deploy.rb:3:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from Capfile:4:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `load_recipes'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `load_recipes'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:31:in `execute!'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:14:in `execute'
from /usr/bin/cap:4
as google suggested i tried to reinstall capistrano, but this failed because of dependencies(net-ssh requires ruby >= 2.0)
so i installed net-ssh v2.9.2
sudo gem install net-ssh -v 2.9.2
Fetching: net-ssh-2.9.2.gem (100%)
Successfully installed net-ssh-2.9.2
1 gem installed
but now the next dependency error occures...
How do i make a fresh installation of capistrano working?
do i need a newer version of ruby(apt-get install ruby tells me that the newest version is already installed)?
Or is the cause of this error something complete different?
I can't see anything in your trace about what version of ruby you're on, but you did say "net-ssh requires ruby >= 2.0", so you might need a newer version of ruby like you said. You can check the version of ruby you're using with ruby -v. I would also recommend using a version manager so that you can use multiple versions between projects. I find RVM or rbenv to be good starting points.
OK, this is strange...
after running vagrant provision multiple(~5) times and installing/deinstalling multiple gems and ruby versions the next "vagrant provision" fixed the problem magicaly. i still dont know why this error occured and what fixed it, bull i'll close this question...

Ruby dependency issue on MacOSX

I'm trying to get started with the excellent deliver tool (https://github.com/KrauseFx/deliver) but I know nothing about ruby. So when I try to run deliver init and I get this message, I don't know what to do about it:
/Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:2052:in `raise_if_conflicts': can't activate json-1.6.8, already activated json-1.8.1 (Gem::LoadError)
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1262:in `activate'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:96:in `block in require'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:95:in `each'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:95:in `require'
from /Users/sarbogast/.rvm/gems/ruby-2.1.0#global/gems/deliver-0.3.6/lib/deliver.rb:1:in `<top (required)>'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/sarbogast/.rvm/gems/ruby-2.1.0#global/gems/deliver-0.3.6/bin/deliver:5:in `<top (required)>'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/bin/deliver:23:in `load'
from /Users/sarbogast/.rvm/rubies/ruby-2.1.0/bin/deliver:23:in `<main>'
from /Users/sarbogast/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/sarbogast/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'
What should I do? By the way I'm on MacOSX Yosemite.
If you are using bundler and you have a Gemfile you can try to run it with bundle using:
bundle exec deliver init
In that way Gemfile will pick for you the right version of the json gem.
If you aren't using bundler you should uninstall the newer version of json using:
gem uninstall json
and choosing the 1.8.1 to uninstall. Then you can try to run again deliver init
As a matter of fact, all I had to do was to install json with "sudo gem install json" and it solved my problem.

NameError Rack::Attack installing GitLab 7.2

I've got a NameError installing GitLab 7.2. More precisely when initializing the database:
$ bundle exec rake gitlab:setup RAILS_ENV=production --trace
rake aborted!
NameError: uninitialized constant Rack::Attack
/home/[user]/gitlab/config/application.rb:67:in `<class:Application>'
/home/[user]/gitlab/config/application.rb:9:in `<module:Gitlab>'
/home/[user]/gitlab/config/application.rb:8:in `<top (required)>'
/home/[user]/gitlab/Rakefile:5:in `require'
/home/[user]/gitlab/Rakefile:5:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
Yes, I found this answer discussing the error with an older version of GitLab, where the following line in config/application.rb had to be uncommented
config.middleware.use Rack::Attack
In 7.2. this line is uncommented from the start. It's there. It's apparently where rake chokes.
I renamed config/initializers/rack_attack.rb.example to config/initializers/rack_attack.rb as well.
Installing the bundle gems worked like a charm.
bundle install --deployment --without development test postgres aws
rack-attack is in the bundle's gems folder:
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb
Does anyone know what could be causing this problem? Thanks a lot!
Very ugly workaround™
I added the following line to config/application.rb and it's working:
require '/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb'
Why is this working? What's wrong? Thanks!
I can't add comment, so I need to post it as an answer: You need to update your ruby & gems: take a look at https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md#2-ruby.
GitLab requires Ruby (MRI) 2.0 or 2.1 You will have to use the
standard MRI implementation of Ruby. We love JRuby and Rubinius) but
GitLab needs several Gems that have native extensions.

jekyll serve --watch command raising an error outside of vagrant

Attempting to build a site with Jekyll using the jekyll-assets gem, I noticed that my changes were not being auto regenerated despite using the --watch flag on my jekyll serve command. Was a big headache having to stop the server every time I wanted to see changes in the browser so I tried to troubleshoot the problem and after a while learned that auto regeneration will not occur with the jekyll serve --watch command in Vagrant, which I'm using.
To avoid this headache I attempted to install necessary dependencies outside of Vagrant and jekyll serve --watch but am getting the following:
Configuration file: /Users/jamestargett/Code/jekyll_fingers/_config.yml
/Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- jekyll-assets (LoadError)
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/jamestargett/Code/jekyll_fingers/_plugins/ext.rb:1:in `<top (required)>'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:77:in `block (2 levels) in setup'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:76:in `each'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:76:in `block in setup'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:75:in `each'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:75:in `setup'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/site.rb:29:in `initialize'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/commands/build.rb:5:in `new'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/lib/jekyll/commands/build.rb:5:in `process'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/jekyll-1.4.2/bin/jekyll:97:in `block (2 levels) in <top (required)>'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:66:in `run!'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/delegates.rb:7:in `run!'
from /Users/jamestargett/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'
I've tried googling the problem but am pretty new to web development and a little lost.
I've also faced this problem. Looks like its a bug in the newest Jekyll 1.4.2 build. A fix can be uninstalling Jekyll 1.4.2 and installing a stable release, in my knowledge which is 1.2.1
Uninstall Jekyll and reinstall Jekyll 1.2.1 by following these commands
~ $ gem uninstall jekyll
~ $ gem install jekyll --version(="1.2.1")
Running gem install jekyll -v 1.2.1 would also work

Precompiling assets with Capistrano shows error on load 'deploy/assets'

I'm using rails 3.1.0 and trying to setup Capistrano to precompile assets. Capistrano v2.8.0 has "load 'deploy/assets'" in Capfile. But when I run "cap deploy" it shows the following error:
cap deploy
/usr/lib/ruby/1.8/capistrano/configuration/loading.rb:183:in `find_file_in_load_path': no such file to load -- deploy/assets (LoadError)
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:171:in `load_from_file'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `load'
from Capfile:3:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in `load_recipes'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in `each'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in `load_recipes'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:30:in `execute!'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:14:in `execute'
from /usr/bin/cap:4
UPDATE
It magically started working after I restarted my PC (Ubuntu).
Can you please demonstrate that the cap that you are using is indeed in the bundle?
Please share your Gemfile and your Capfile, chances are that "cap" isn't in the bundle, so it's loading a previous version, be sure to run with "bundle exec" (to make sure to use the correct capistrano)
As I encountered the same problem currently, I noticed that using RVM with a project specific .rvmrc was not reloaded after I switched branches with git checkout. The result was that the system wide capistrano version 2.6.0 was being used instead of the project specific capistrano version 2.9.0. This lead to the same error message 'no such file to load -- deploy/assets (LoadError)'.
A simple cd out of the project path and again into the project path solved the problem for me.
What worked for me for this issue was installing the latest version of capistrano (gem install capistrano).

Resources