libxml/nokogiri not working: cannot load such file -- libxml rails - ruby-on-rails

I am trying to use libxml in my rails app. However I get the error:
cannot load such file -- libxml
as you can see libxml is installed in my gems:
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.0
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.1
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.1
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.1
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.1
Using activemodel 4.1.1
Using arel 5.0.1.20140414130214
Using activerecord 4.1.1
Using bundler 1.6.2
Using coffee-script-source 1.7.1
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.1
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.1.3
Using jquery-rails 3.1.1
Using libxml-ruby 2.7.0
Using pg 0.17.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.3
Using rails 4.1.1
Using rdoc 4.1.1
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.1
Using spring 1.1.3
Using turbolinks 2.2.3
Using uglifier 2.5.3
Your bundle is updated!
I try to use it like this in my controller class:
require 'libxml'
def import
some code that it doesnt even reach
end
Does anyone know what I can do to make it work?
Using it on Mac OSX 10.9.x - Rails 4 - Ruby 2.1.1
UPDATE
I installed nokogiri instead of libxml following the steps in http://nokogiri.org/tutorials/installing_nokogiri.html
and added the gem to the gem file: gem 'nokogiri'
unfortunately the load error persists but now for nokogiri: cannot load such file -- nokogiri

Solved the problem: For some reason I had two different gem paths pointing ruby2.1.0 and Ruby 2.1.1. Including Ruby '2.1.1' in the gemfile solved the problem

Related

Why can't Rails find a gem that I clearly specified in my Gemfile?

I'm using Ruby 2.4 with Rails 5.0.1. I'm confused about why Rails says it can't find a gem. I get this error when visiting a page
Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
However, I have specified this in my Gemfile
gem 'pg'
Here is the output when I run "bundle install". You can see that "pg" is making it in there. How do I get Rails to recognize the gem?
localhost:scale nataliab$ bundle install
Your Gemfile lists the gem jquery-rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Using rake 12.3.0
Using concurrent-ruby 1.0.5
Using i18n 0.9.3
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.4
Using activesupport 5.0.6
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.1
Using rails-dom-testing 2.0.3
Using crass 1.0.3
Using loofah 2.1.1
Using rails-html-sanitizer 1.0.3
Using actionview 5.0.6
Using rack 2.0.3
Using rack-test 0.6.3
Using actionpack 5.0.6
Using nio4r 2.2.0
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.0.6
Using globalid 0.4.1
Using activejob 5.0.6
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.0.6
Using activemodel 5.0.6
Using arel 7.1.4
Using activerecord 5.0.6
Using bindex 0.5.0
Using bundler 1.16.1
Using byebug 10.0.0
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.0.6
Using coffee-rails 4.2.2
Using multipart-post 2.0.0
Using faraday 0.12.2
Using ffi 1.9.18
Using hashie 3.5.7
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using jquery-rails 4.3.1
Using jquery-ui-rails 6.0.1
Using jwt 1.5.6
Using rb-fsevent 0.10.2
Using rb-inotify 0.9.10
Using listen 3.0.8
Using multi_xml 0.6.0
Using oauth 0.5.4
Using oauth2 1.4.0
Using omniauth 1.8.1
Using omniauth-oauth2 1.3.1
Using omniauth-facebook 4.0.0
Using omniauth-google-oauth2 0.5.2
Using omniauth-linkedin-oauth2 0.2.5
Using omniauth-oauth 1.1.0
Using omniauth-twitter 1.4.0
Using pg 1.0.0
Using puma 3.11.2
Using sprockets 3.7.1
Using sprockets-rails 3.2.1
Using rails 5.0.6
Using rmagick 2.16.0
Using ruby-filemagic 0.7.2
Using sass-listen 4.0.0
Using sass 3.5.5
Using tilt 2.0.8
Using sass-rails 5.0.7
Using spring 2.0.2
Using spring-watcher-listen 2.0.1
Using sqlite3 1.3.13
Using turbolinks-source 5.1.0
Using turbolinks 5.1.0
Using uglifier 4.1.4
Using web-console 3.5.1
Bundle complete! 25 Gemfile dependencies, 81 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
lock pg gem at 0.21.0 gem 'pg', '0.21.0' since rails does not yet support pg at 1.0.0

rails cant find gems even after bundle install

I am creating an application with rails, but when I run rake db:migrate I get the error
Could not find coffee-script-source-1.12.2 in any of the sources
Run bundle install to install missing gems.
I ran bundle install and nothing happens. When I install the gem manually through gem install and run rake db:migrate I get the same error for a different gem.
I suppose my application or bundler can't find the path to the gems /var/lib/gems/2.3.0/gems/[gemname]. Why is that happening? How can I install all gems at once?
EDIT: BUNDLE INSTALL output
Using rake 12.3.0
Using concurrent-ruby 1.0.5
Using i18n 0.9.1
Using json 1.8.6
Using minitest 5.11.1
Using thread_safe 0.3.6
Using tzinfo 1.2.4
Using activesupport 4.2.6
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.1
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.9
Using crass 1.0.3
Using loofah 2.1.1
Using rails-html-sanitizer 1.0.3
Using actionview 4.2.6
Using rack 1.6.8
Using rack-test 0.6.3
Using actionpack 4.2.6
Using globalid 0.4.1
Using activejob 4.2.6
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 4.2.6
Using activemodel 4.2.6
Using arel 6.0.4
Using activerecord 4.2.6
Using activerecord-oracle_enhanced-adapter 1.6.9
Using debug_inspector 0.0.3
Using binding_of_caller 0.8.0
Using bundler 1.16.1
Using byebug 9.1.0
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using thor 0.20.0
Using railties 4.2.6
Using coffee-rails 4.1.1
Using ffi 1.9.18
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using jquery-rails 4.3.1
Using sprockets 3.7.1
Using sprockets-rails 3.2.1
Using rails 4.2.6
Using rb-fsevent 0.10.2
Using rb-inotify 0.9.10
Using rdoc 4.3.0
Using ruby-oci8 2.2.5.1
Using sass-listen 4.0.0
Using sass 3.5.5
Using tilt 2.0.8
Using sass-rails 5.0.7
Using sdoc 0.4.2
Using spring 2.0.2
Using turbolinks-source 5.1.0
Using turbolinks 5.1.0
Using uglifier 4.1.3
Using web-console 2.3.0
Bundle complete! 13 Gemfile dependencies, 61 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Bundle install foundation-icons-sass-rails 3

I'm having an issue with foundation-icons-sass-rails
When i bundle install, it installs without an issue.
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.4
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.4
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.4
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.4
Using activemodel 4.1.4
Using arel 5.0.1.20140414130214
Using activerecord 4.1.4
Using bcrypt 3.1.7
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.4
Using coffee-rails 4.0.1
Using orm_adapter 0.5.0
Using warden 1.2.3
Using devise 3.3.0
Using sass 3.2.19
Using hike 1.2.3
Using multi_json 1.10.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.4
Using sass-rails 4.0.3
Installing foundation-icons-sass-rails 3.0.0
Using foundation-rails 5.4.3.0
Using jquery-rails 3.1.2
Using kaminari 0.16.1
Using mysql2 0.3.16
Using polyamorous 1.1.0
Using bundler 1.6.2
Using rails 4.1.4
Using ransack 1.3.0
Using spring 1.1.3
Using sqlite3 1.3.9
Using turbolinks 2.3.0
Using uglifier 2.5.3
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
And this is the output from trying to start rails console
$ rails c
Could not find foundation-icons-sass-rails-3.0.0 in any of the sources
Run `bundle install` to install missing gems.
I'm using rvm with gemsets.
Ruby 2.1.2
I've tried deleting gemset and all gems, then re-installing etc. and nothing works. Any ideas on this would be amazing, this is killing me!
Thanks!
Try running bin/spring stop to force your application to re-initialize.

Rails says json 1.8.1 is missing even though its listed during bundle install

I did rails new awesomeapp then when I go to do rails s, I get an error that json-1.8.1 is missing. But when I do bundle install, it's clearly listed. What am I missing?
Donalds-MacBook-Pro:awesomeapp · rails s
Could not find json-1.8.1 in any of the sources
Run `bundle install` to install missing gems.
Donalds-MacBook-Pro:awesomeapp · bundle install
Using rake 10.3.2
Using i18n 0.6.9
Using json 1.8.1
Using minitest 5.3.5
Using thread_safe 0.3.4
Using tzinfo 1.2.1
Using activesupport 4.1.0
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.0
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.0
Using activemodel 4.1.0
Using arel 5.0.1.20140414130214
Using activerecord 4.1.0
Using sass 3.3.9
Using bootstrap-sass 3.0.1.0
Using sassy-maps 0.4.0
Using breakpoint 2.4.2
Using chunky_png 1.3.1
Using coffee-script-source 1.7.0
Using execjs 2.2.1
Using coffee-script 2.2.0
Using thor 0.19.1
Using railties 4.1.0
Using coffee-rails 4.0.1
Using fssm 0.2.10
Using compass 0.12.2
Using hike 1.2.3
Using multi_json 1.10.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using compass-rails 1.1.7
Using jbuilder 2.1.1
Using jquery-rails 3.1.1
Using normalize-rails 3.0.1
Using bundler 1.6.2
Using sprockets-rails 2.0.1
Using rails 4.1.0
Using rdoc 4.1.1
Using sass-rails 4.0.1
Using sdoc 0.4.0
Using spring 1.1.3
Using sqlite3 1.3.9
Using susy 2.1.0
Using turbolinks 2.2.2
Using uglifier 2.5.1
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Donalds-MacBook-Pro:awesomeapp · rails s
Could not find json-1.8.1 in any of the sources
Run `bundle install` to install missing gems.
Donalds-MacBook-Pro:awesomeapp ·
I think that you need to update your bundler.
Try running:
bundle update
bundle install
rails s

Phusion Passenger wants always to run bundle install

Phusion Passenger + Nginx
The web site worked fine for today. Today i updated my code, added my user for sudo group and run 'sudo bundle install' and 'touch tmp/restart.txt'. After that i saw 'bundle install error' - http://url.od.ua it still there
I tryed to run 'bundle install' from root user, but it nothing changed.
It worked before! How i can fix it?
url.od.ua#server:~/web$ bundle install
Using rake 10.1.0
Using i18n 0.6.5
Using minitest 4.7.5
Using multi_json 1.8.0
Using atomic 1.1.14
Using thread_safe 0.1.3
Using tzinfo 0.3.37
Using activesupport 4.0.0
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.0
Using mime-types 1.25
Using polyglot 0.3.3
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.0
Using activemodel 4.0.0
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.0
Using activerecord 4.0.0
Using coderay 1.0.9
Using coffee-script-source 1.6.3
Using execjs 2.0.1
Using coffee-script 2.2.0
Using thor 0.18.1
Using railties 4.0.0
Using coffee-rails 4.0.0
Using diff-lcs 1.2.4
Using exception_notification 4.0.1
Using factory_girl 4.2.0
Using factory_girl_rails 4.2.1
Using tilt 1.4.1
Using haml 4.0.3
Using hike 1.2.3
Using jbuilder 1.5.1
Using jquery-rails 2.3.0
Using json 1.8.0
Using libv8 3.16.14.3
Using method_source 0.8.2
Using mini_portile 0.5.1
Using mysql2 0.3.11
Using newrelic_rpm 3.6.6.147
Using nokogiri 1.6.0
Using slop 3.4.6
Using pry 0.9.12.2
Using bundler 1.6.1
Using sprockets 2.10.0
Using sprockets-rails 2.0.0
Using rails 4.0.0
Using rdoc 3.12.2
Using ref 1.0.5
Using rspec-core 2.14.5
Using rspec-expectations 2.14.2
Using rspec-mocks 2.14.3
Using rspec-rails 2.14.0
Using sape-rails 0.0.1 from git://github.com/hazg/sape-rails (at master)
Using sass 3.2.10
Using sass-rails 4.0.0
Using sdoc 0.3.20
Using therubyracer 0.12.1
Using turbolinks 1.3.0
Using uglifier 2.2.1
Using webrat 0.7.3
Using will_paginate 3.0.4
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
url.od.ua#server:~/web$ touch tmp/restart.txt
I've referred this link and installed it again.
I installed rvm, and all works fine!

Resources