Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[RUBY] json not found by package
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Sat May 25, 2013 12:32 am    Post subject: [RUBY] json not found by package Reply with quote

So I wanted to experiment with Octopress. After following the installtion guide and creating some test-posts/-pages, I hit a bump while trying to generate the page.

Code:
> rake generate
## Generating Site with Jekyll
identical source/stylesheets/screen.css
Configuration from /home/avx/octopress/_config.yml
/home/avx/octopress/plugins/config_tag.rb:2:in `require': cannot load such file -- json (LoadError)
   from /home/avx/octopress/plugins/config_tag.rb:2:in `<top (required)>'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:78:in `require'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:78:in `block (2 levels) in setup'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:77:in `each'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:77:in `block in setup'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:76:in `each'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:76:in `setup'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:31:in `initialize'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/bin/jekyll:238:in `new'
   from /home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/bin/jekyll:238:in `<top (required)>'
   from /home/avx/.gem/ruby/1.9.1/bin/jekyll:23:in `load'
   from /home/avx/.gem/ruby/1.9.1/bin/jekyll:23:in `<main>'

Ok, so I thought, json seems to be missing, thus I tried installing dev-ruby/json -> no change, installed dev-ruby/multi_json -> still no change.

Then I went to #octopress@freenode and had a chat with a few helpful guys, who told me that json isn't listed as a dependency because it's part of Ruby's standard lib as of 1.9.3(which octopress requires).

Foolishly I thought I had taken care of that by installing dev-ruby/json, but it doesn't get picked up. 'require json' in irb returned true, so the system obviously knows where it is. Then the guys told me to try the same in the octopress directory with `bundle exec irb` and *boom*, there I get the same loadError.

So I modified the Gemfile and added json as a dependency, ran `bundle install` again, but it didn't get fetched. After some tinkering I found that I can fetch it this way if I uninstall dev-ruby/json first. Installing via the bundle command then worked and so did 'rake generate'.

So I asked them to add json to the Gemfile, but they declined stating that it's not the same as the one in the stdlib and might give problems. I don't have any inside on that, but also no reason to not trust them on this.

I googled a little and found that it should be of help to add "require 'rubygems'" to the files in question, so I did, but to no avail.

Now these are pretty much my first experiments with Ruby stuff from outside portage and because of that and for easier updating, I'd like to rely on as much stuff from portage as possible. So the question is, what's wrong that octopress doesn't find json and how can it be fixed?

--
On a sidenote, how come that I've got Ruby 1.9.3, but all stuff is installed in folders labeled 1.9.1?

Edit, maybe it helps:

Code:
> irb
irb(main):001:0> $:
=> ["/usr/lib64/ruby/site_ruby/1.9.1", "/usr/lib64/ruby/site_ruby/1.9.1/x86_64-linux", "/usr/lib64/ruby/site_ruby", "/usr/lib64/ruby/vendor_ruby/1.9.1", "/usr/lib64/ruby/vendor_ruby/1.9.1/x86_64-linux", "/usr/lib64/ruby/vendor_ruby", "/usr/lib64/ruby/1.9.1", "/usr/lib64/ruby/1.9.1/x86_64-linux"]
irb(main):002:0>

Code:
> bundle exec irb
irb(main):001:0> $:
=> ["/home/avx/.gem/ruby/1.9.1/gems/stringex-1.4.0/lib", "/home/avx/.gem/ruby/1.9.1/gems/sinatra-1.4.2/lib", "/home/avx/.gem/ruby/1.9.1/gems/tilt-1.3.7/lib", "/home/avx/.gem/ruby/1.9.1/gems/sass-globbing-1.0.0/lib", "/home/avx/.gem/ruby/1.9.1/gems/rubypants-0.2.0/.", "/home/avx/.gem/ruby/1.9.1/gems/rdiscount-2.0.7.3/lib", "/home/avx/.gem/ruby/1.9.1/gems/rb-fsevent-0.9.1/lib", "/home/avx/.gem/ruby/1.9.1/gems/rack-protection-1.5.0/lib", "/home/avx/.gem/ruby/1.9.1/gems/rack-1.5.2/lib", "/home/avx/.gem/ruby/1.9.1/gems/jekyll-0.12.0/lib", "/home/avx/.gem/ruby/1.9.1/gems/pygments.rb-0.3.4/lib", "/home/avx/.gem/ruby/1.9.1/gems/yajl-ruby-1.1.0/lib", "/home/avx/.gem/ruby/1.9.1/gems/posix-spawn-0.3.6/lib", "/home/avx/.gem/ruby/1.9.1/gems/maruku-0.6.1/lib", "/home/avx/.gem/ruby/1.9.1/gems/syntax-1.0.0/lib", "/home/avx/.gem/ruby/1.9.1/gems/liquid-2.3.0/lib", "/home/avx/.gem/ruby/1.9.1/gems/kramdown-0.13.8/lib", "/home/avx/.gem/ruby/1.9.1/gems/haml-3.1.7/lib", "/home/avx/.gem/ruby/1.9.1/gems/directory_watcher-1.4.1/lib", "/home/avx/.gem/ruby/1.9.1/gems/compass-0.12.2/lib", "/home/avx/.gem/ruby/1.9.1/gems/sass-3.1.20/lib", "/home/avx/.gem/ruby/1.9.1/gems/fssm-0.2.9/lib", "/home/avx/.gem/ruby/1.9.1/gems/classifier-1.3.3/lib", "/home/avx/.gem/ruby/1.9.1/gems/fast-stemmer-1.0.1/lib", "/home/avx/.gem/ruby/1.9.1/gems/chunky_png-1.2.5/lib", "/home/avx/.gem/ruby/1.9.1/gems/RedCloth-4.2.9/lib", "/home/avx/.gem/ruby/1.9.1/gems/RedCloth-4.2.9/lib/case_sensitive_require", "/home/avx/.gem/ruby/1.9.1/gems/RedCloth-4.2.9/ext", "/usr/lib64/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib", "/usr/lib64/ruby/gems/1.9.1/gems/bundler-1.3.5/lib", "/usr/lib64/ruby/site_ruby/1.9.1", "/usr/lib64/ruby/site_ruby/1.9.1/x86_64-linux", "/usr/lib64/ruby/site_ruby", "/usr/lib64/ruby/vendor_ruby/1.9.1", "/usr/lib64/ruby/vendor_ruby/1.9.1/x86_64-linux", "/usr/lib64/ruby/vendor_ruby", "/usr/lib64/ruby/1.9.1", "/usr/lib64/ruby/1.9.1/x86_64-linux"]

_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
ir3n4lrnor
n00b
n00b


Joined: 29 May 2013
Posts: 1

PostPosted: Wed May 29, 2013 8:30 pm    Post subject: Same problem Reply with quote

I had the same problem.
1) Add json to your Gemfile
2) Use `bundle exec rake` instead of just rake. This will use exactly the specifications defined in your Gemfile.

You don't have to remove anything.
I got the error message: ... `require': cannot load such file -- json (LoadError) and found out that the command
`require 'json'`produced the same LoadError in `bundle exec irb`

I guess adding 'json' to the Gemfile would be the right way.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum