On Tue, Dec 13, 2011 at 6:01 PM, Nathan Feaver <li...@ruby-forum.com> wrote:

> Hi all,
> I'm using Ubuntu 11.10 and the terminal to install and run Rails.  Here
> is the process I've taken so far to setup Rails:
>
> > download and install Ruby 1.9.2 and Rails 3.1.0
> -- I did this using 'sudo apt-get ruby1.9.1' and 'sudo gem install
> rails'
> > I made a new rails app using 'rails new path/to/app'
> > I went to the new app directory and tried running 'rails server' and got
> an
> error about not having a JS ruby environment
> > I had to get a JS runtime environment for execjs so I downloaded
> 'therubyracer'
> as well as 'therubyrhino' and added them to my gem file, one at a time:
> 'gem
> 'therubyracer'' then ran 'bundle install'
> > After everything was successful with the install, I ran 'rails server'
> again
> -- with both runtime environments I have had similar errors:
>
> Could not find libv8-3.3.10.4 in any of the sources
> Run `bundle install` to install missing gems.
>
> Could not find therubyrhino-1.73.0 in any of the sources
> Run `bundle install` to install missing gems.
>
> Bundle knows where these programs live, giving correct pathnames when I
> enter 'bundle show libv8' or 'bundle show therubyrhino'.  They are both
> in /usr/lib/ruby/gems/1.9.1/gems/___  where all the other gems are
> located for the bundle install.
>
> Does anyone know where this exception is coming up in the Rails source
> code?  Does anyone know how Rails is gathering the gems?  Better yet,
> anyone had this problem and know how to fix it?
>

A few replies:

1) Where does Rails call the bundler code ?

../config/boot.rb
More info in section 1.4 config/boot.rb of
http://guides.rubyonrails.org/initialization.html

I just tried to replay that code.

When the rubyracer gem is present:

peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ irb
001:0> require 'bundler'
=> true
002:0> gemfile = File.expand_path('../../Gemfile', __FILE__)
=> "/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile"
003:0> ENV['BUNDLE_GEMFILE'] = gemfile
=> "/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile"
004:0> Bundler.setup
=> "GEM\n  remote: http://rubygems.org/\n  specs:\n  ...
...
   libv8 (3.3.10.2)\n
...
 therubyracer (0.9.4)\n      libv8 (~> 3.3.10)\n


When the rubyracer is removed (with gem uninstall libv8), I get:


peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ gem uninstall libv8

You have requested to uninstall the gem:
libv8-3.3.10.2-x86-linux
therubyracer-0.9.4 depends on [libv8 (~> 3.3.10)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled libv8-3.3.10.2-x86-linux


peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ irb
001:0> require 'bundler'
=> true
...
003:0> gemfile = File.expand_path('../../Gemfile', __FILE__)
=> "/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile"
004:0> ENV['BUNDLE_GEMFILE'] = gemfile
=> "/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile"
005:0> Bundler.setup
Bundler::GemNotFound: Could not find libv8-3.3.10.2 in any of the sources
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/spec_set.rb:90:in
`block in materialize'
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/spec_set.rb:83:in
`map!'
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/spec_set.rb:83:in
`materialize'
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/definition.rb:90:in
`specs'
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/definition.rb:135:in
`specs_for'
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/definition.rb:124:in
`requested_specs'
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/environment.rb:23:in
`requested_specs'
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/runtime.rb:11:in
`setup'
from 
/home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler.rb:109:in
`setup'
from (irb):5
from /home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
006:0> quit

peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ bundle install
Fetching gem metadata from http://rubygems.org/.....
Using rake (0.9.2)
...
Installing libv8 (3.3.10.2)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled
gem is installed.

peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ irb
001:0> gemfile = File.expand_path('../../Gemfile', __FILE__)
=> "/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile"
002:0> ENV['BUNDLE_GEMFILE'] = gemfile
=> "/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile"
003:0> require 'bundler'
=> true
004:0> Bundler.setup
success

2) One hint may to run

$ bundle exec gem list

and carefully inspect the outcome (can be different from $ gem list)

Also study your Gemfile.lock file in detail for dependencies. Are all
dependencies met ? Does `bundle update` help you? What is the
exact version of the libv8 you have installed?


3) (slightly off-topic) How to avoid these issues altogether ?

This may be off-topic for your specific question, but in general, I find it
easier
to set-up a dev server on Ubuntu 10.x, 11.x with rvm. I published my recent
experiences here:

http://rails.vandenabeele.com/blog/2011/11/26/installing-ruby-and-rails-with-rvm-on-ubuntu-11-dot-10/

Regarding the set-up of  "therubyracer", this is how it worked in
the rvm environment:

<quote>
~/data/git/NewProject$ echo "gem 'therubyracer'" >> Gemfile
~/data/git/NewProject$ bundle install
Fetching source index for http://rubygems.org/
...
Installing libv8 (3.3.10.4)
...
Installing therubyracer (0.9.9) with native extensions
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled
gem is installed.
</quote>

and that worked out of the box.

I Hope This Helps,

Peter

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to