LoadError: incompatible library version with nokogiri 1.6.8.1 - ruby-on-rails-3

I am working on quite old project which is running on old version of Ruby and Rails.
Ruby Version = 1.9.3p551
Rails verison = 3.1.10
So when i am trying to configure this project on new machine the it shows
the error related to NOKOGIRI.
"LoadError: incompatible library version - /home/global/.rvm/gems/ruby-1.9.3-p551/gems/nokogiri-1.6.8.1/lib/nokogiri/nokogiri.so
/home/global/.rvm/gems/ruby-1.9.3-p551/gems/nokogiri-1.6.8.1/lib/nokogiri.rb:32:in require'
/home/global/.rvm/gems/ruby-1.9.3-p551/gems/nokogiri-1.6.8.1/lib/nokogiri.rb:32:inrescue in '
/home/global/.rvm/gems/ruby-1.9.3-p551/gems/nokogiri-1.6.8.1/lib/nokogiri.rb:28:in <top (required)>'
/var/www/glo/config/application.rb:7:in'
/var/www/glo/Rakefile:4:in <top (required)>'
LoadError: cannot load such file -- nokogiri/2.3/nokogiri
/home/global/.rvm/gems/ruby-1.9.3-p551/gems/nokogiri-1.6.8.1/lib/nokogiri.rb:30:inrequire'
/home/global/.rvm/gems/ruby-1.9.3-p551/gems/nokogiri-1.6.8.1/lib/nokogiri.rb:30:in <top (required)>'
/var/www/glo/config/application.rb:7:in'
/var/www/glo/Rakefile:4:in `'
(See full trace by running task with --trace)
global#del1-lhp-N01167:/var/www/glo$ ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
"
I have tried many things but still this problem is not solved.
So please help me out from this.
Thanks

Related

Jekyll Serve not working.Uninitialized constant. Windows 8

I have installed Jekyll on Windows 8 and created a new application. I am inside the directory and it gives me this error when I run jekyll serve
C:/Blog/> jekyll serve
C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/psych_resolver
.rb:4:in `<class:PsychResolver>': uninitialized constant Psych::Nodes (NameError
)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/p
sych_resolver.rb:2:in `<module:SafeYAML>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/p
sych_resolver.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/l
oad.rb:131:in `<module:SafeYAML>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/safe_yaml-1.0.4/lib/safe_yaml/l
oad.rb:26:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll.rb:26:i
n `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_requir
e.rb:69:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.5.3/bin/jekyll:6:in `<
top (required)>'
from C:/Ruby200/bin/jekyll:23:in `load'
from C:/Ruby200/bin/jekyll:23:in `<main>'
Here is my _config.yml file
# Site settings
title: Your awesome title
email: your-email#domain.com
description: > # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://yourdomain.com" # the base hostname & protocol for your site
twitter_username: jekyllrb
github_username: jekyll
# Build settings
markdown: kramdown
Thanks if anyone can help!
run gem cleanup it should solve the problem
This happened to me I fixed it by doing this:
First list your gems gem list
...
pg_search (0.7.9)
polyglot (0.3.5)
posix-spawn (0.3.10)
power_assert (0.2.2)
psych (2.0.5, 2.0.0)
pygments.rb (0.6.2)
rack (1.6.0)
rack-cache (1.2)
rack-protection (1.5.3)
...
Where you see psych, try using psych 2.0.5 gem uninstall psych -v 2.0.0
If you get an error message than uninstall gem 2.0.5 instead gem uninstall psych -v 2.0.5
Try Jekyll. This worked for me. You need to find the version of psych that interacts with your Ruby setup correctly. In my case was 2.0.0 but could be different for you.
Try bundle exec jekyll serve in some cases this will solve your issues.

Rails console not working with redgreen gem

I have a problem with rails console, here is what I am getting when I try to start rails console:
backo#speedy:~/ucimrails/simple_app$ rails c --sandbox
/home/backo/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in require': no such file to load -- test/unit/ui/console/testrunner (LoadError)
from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:inblock in require'
from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in load_dependency'
from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:inrequire'
from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/redgreen-1.2.2/lib/redgreen.rb:2:in <top (required)>'
from /home/backo/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:inrequire'
from /home/backo/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in block (2 levels) in require'
from /home/backo/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:ineach'
from /home/backo/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in block in require'
from /home/backo/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:ineach'
from /home/backo/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in require'
from /home/backo/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.1.4/lib/bundler.rb:119:inrequire'
from /home/backo/ucimrails/simple_app/config/application.rb:13:in <top (required)>'
from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.2/lib/rails/commands.rb:39:inrequire'
from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.2/lib/rails/commands.rb:39:in <top (required)>'
from script/rails:6:inrequire'
from script/rails:6:in `'
I located the problem is caused by redgreen gem. When I exclude it from Gemfile, console works again. But, can someone help me to make it working with redgreen gem? Interesting is that this is only happening on my netbok, when I work on my desktop computer all is fine with rails console.
Specifying in my Gemfile:
gem 'test-unit', '1.2.3'
...seems to work for me with 1.9.3 and Rails 3.2.8. It would, however, be nice to use this with a more recent version of test-unit (looks like 2.5.2 is the latest right now)...
The redgreen gem doesn't work with 1.9.2; for redgreen test output you might try
require 'test/unit'
require 'test/unit/ui/console/testrunner'
class Test::Unit::UI::Console::TestRunner
def guess_color_availability; true; end
end
in your test helper or so.

Rails - rMagic is not working?

I am trying ti use "carrierWave". I have installed "imagemagic" using homebrew and both rmagic and carrierwave gems.
When I run rails g uploader image I get this error in terminal -
Will appreciate any help
Shani
shannoga$ rails g uploader image
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0/gems/rmagick-2.13.1/lib/rmagick.rb:11:in
require':
dlopen(/Users/shannoga/.rvm/gems/ruby-1.9.3-p0/gems/rmagick-2.13.1/lib/RMagick2.bundle,
9): Library not loaded: /usr/X11/lib/libfreetype.6.dylib (LoadError)
Referenced from: /usr/local/lib/libMagickCore.5.dylib Reason:
Incompatible library version: libMagickCore.5.dylib requires version
14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0 - /Users/shannoga/.rvm/gems/ruby-1.9.3-p0/gems/rmagick-2.13.1/lib/RMagick2.bundle
from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0/gems/rmagick-2.13.1/lib/rmagick.rb:11:in
' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in
require' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in
block (2 levels) in require' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in
each' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in
block in require' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in
each' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in
require' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.22/lib/bundler.rb:122:in
require' from
/Users/shannoga/SITES/ANGELS_APP_CMS/config/application.rb:7:in' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:24:in
require' from
/Users/shannoga/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:24:in
' from script/rails:6:in require' from
script/rails:6:in'
If any one gets into this problem -
I was using mountain lion and had to manually install the latest xQuartz for mountain lion and every thing works fine now.
Installing the latest xQuarts and running a system update worked for me. Related to this other post: Imagemagick issue on Lion installed with Homebrew

rake db:migrate aborted! on US-ASCII using rake 0.9.2.2 and rails 3.0.10

Recently I upgraded my gems and started adding new stuff to my app like authentication by third party social websites using omniauth gem. On development environment everything is fine and works like a charm.
I am deploying to staging and production servers using capistrano. Basic deployment is fine and working so far, but I have got really strange problems when I want to do migrations when deploying.
I get the following error messages from capistrano:
[my.server.com] executing command
*** [err :: my.server.com] rake aborted!
*** [err :: my.server.com] "\xC5" on US-ASCII
*** [err :: my.server.com]
*** [err :: my.server.com] (See full trace by running task with --trace)
command finished in 2472ms
I was googling all around and couldn't find any relevant solution. I also tried to downgrade rake gem back to 0.8.7 but with no success on the end - the same errors.
After hours of googling and digging in I found the solution that (I hope) may by helpful for someone with a similar or the same problem.
I did bundle exec rake --trace db:migrate on the staging server and got the following error messages:
rake aborted!
"\xC5" on US-ASCII
/var/www/myapp/test.myapp.com/releases/20111230233802/config/application.rb:5:in `read'
/var/www/myapp/test.myapp.com/releases/20111230233802/config/application.rb:5:in `<top (required)>'
/var/www/myapp/test.myapp.com/releases/20111230233802/Rakefile:4:in `require'
/var/www/myapp/test.myapp.com/releases/20111230233802/Rakefile:4:in `<top (required)>'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/bin/rake:19:in `load'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
So I jumped in to the config/application.rb file to find out what could rise the error. Line 5 of that file loads an external config file:
require 'yaml'
APP_CONFIG = YAML.load(File.read(File.expand_path('../app_config.yml', __FILE__)))
and that external file contains UTF-8 chars, not US-ASCII. So I tried a couple of different solutions to solve that problem.
The only one which worked for me was to add an extra few lines of code on top of config/application.rb file:
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
just to tell rake to load external files using utf-8 encoding. After that change everything went smooth and exactly as expected. Problem solved!
PS.
I really don't know why developers of rake 0.9 have changed previous behavior of rake 0.8 which worked fine for me and probably for you as well for a long time. Maybe you have an idea why? I am very curious.

bundle exec rspec VS rspec spec

Ruby 1.9.2 Rails 3.1
Here is the problem bundle exec rspec spec/ does not work, but rspec spec/ runs ok.
When I run c:\RailsInstaller\work\apptwit>bundle exec rspec spec/ (this is the directory where my app is located, so the path to spec would not need to be specified)
I receive
c:/RailsInstaller/work/apptwit/spec/controllers/pages_controller_spec.rb:1:in `require': no such file to load -- spec_he lper (LoadError)
from c:/RailsInstaller/work/apptwit/spec/controllers/pages_controller_spec.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:i
n `load'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:i
n `block in load_spec_files'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:i
n `map'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:i
n `load_spec_files'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18:in
`run'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_i
n_process'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block
in autorun'
/spec directory exists as exists spec_helper.rb in it.
So basically I have 2 questions:
Why doesn't bundle exec rspec spec/ work while rspec spec/ has no problems?
What is the difference between those two commands?
Take a look at this answer. bundle exec changes your $PATH, or %PATH% in case of Windows. As a result, by using bundle exec rspec you're calling the RSpec's version which is specified in your Gemfile. rspec ran without Bundler executes the one in your $PATH.
The error you see might be caused by the fact that the RSpec version in your $PATH is incompatible with Rails version you're working with. The version installed and executed by Bundler (with bundle exec rspec) is compatible and works fine.