1

I copied the application from production and did bundle install to install all the missing gems that are in production version and not on my local machine.

Gem.lock file has the rubyracer version '0.10.1'. So when it tried to install this version using bundle install following error appeared.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/user/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb                                                                                                                                                                                                           
*** extconf.rb failed ***                                                                                                                                                                                                                                                      
Could not create Makefile due to some reason, probably lack of                                                                                                                                                                                                                 
necessary libraries and/or headers.  Check the mkmf.log file for more                                                                                                                                                                                                          
details.  You may need configuration options.                                                                                                                                                                                                                                  

Provided configuration options:                                                                                                                                                                                                                                                
        --with-opt-dir                                                                                                                                                                                                                                                         
        --without-opt-dir                                                                                                                                                                                                                                                      
        --with-opt-include                                                                                                                                                                                                                                                     
        --without-opt-include=${opt-dir}/include                                                                                                                                                                                                                               
        --with-opt-lib                                                                                                                                                                                                                                                         
        --without-opt-lib=${opt-dir}/lib                                                                                                                                                                                                                                       
        --with-make-prog                                                                                                                                                                                                                                                       
        --without-make-prog                                                                                                                                                                                                                                                    
        --srcdir=.                                                                                                                                                                                                                                                             
        --curdir                                                                                                                                                                                                                                                               
        --ruby=/home/user/.rvm/rubies/ruby-1.9.3-p392/bin/ruby                                                                                                                                                                                                               
extconf.rb:15:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)                                                                                                                                                                                    


Gem files will remain installed in /home/user/.rvm/gems/ruby-1.9.3-p392/gems/therubyracer-0.10.1 for inspection.                                                                                                                                                             
Results logged to /home/user/.rvm/gems/ruby-1.9.3-p392/gems/therubyracer-0.10.1/ext/v8/gem_make.out      

I am not able to run the scaffolding commands on my production version of code from my local machine because of this error . Please help me out.

Can we edit the gemfile.lock to remove "therubyracer (0.10.1)" and then run the command generate scaffold and then place back the changes after my use of generate scaffold ?

EDIT :

 *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/vsadhu/.rvm/rubies/ruby-1.9.3-p392/bin/ruby
extconf.rb:14:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)
user2569524
  • 1,651
  • 7
  • 32
  • 57
  • assuming that `ruby-racer` is in a production group try `bundle install --without production` – j03w Aug 29 '13 at 15:18
  • @j03w .. true but when I navigate to my production server and run generate scaffolding, it will not run, reason being gemfile.lock contains the ruby racer with 0.10.1 version . and says its missing – user2569524 Aug 29 '13 at 15:21
  • what's your local environment? have you check `/home/user/.rvm/gems/ruby-1.9.3-p392/gems/therubyracer-0.10.1/ext/v8/gem_make.out` and see what's missing? – j03w Aug 29 '13 at 15:27
  • No . I dont have ruby racer with 0.10.1 version on my local machine. and am unable to install it due to the above error that i posted in my post. But gemfile.lock of production requires it. – user2569524 Aug 29 '13 at 15:32
  • do you perhaps misread my question? I asked if you have looked up what error had occurred that made gem installation failed. The stack trace said right there that the error will be contained within `/home/user/.rvm/gems/ruby-1.9.3-p392/gems/therubyracer-0.10.1/ext/v8/gem_make.out` so could you please have a look and update your question with it? – j03w Aug 29 '13 at 15:35
  • @j03w edited my post ... please have a look at it now . Thanks! – user2569524 Aug 29 '13 at 15:49
  • I don't think you got the right file. Did you perhaps omit `.out`? it should be a log file not a ruby script – j03w Aug 29 '13 at 15:53
  • @j03w .. please check it now . – user2569524 Aug 29 '13 at 15:54
  • try this http://stackoverflow.com/a/10905900/832759 – j03w Aug 29 '13 at 15:58
  • @j03w Will it not cause any other problem when I uninstall libv8 from gems ? what is libv8 used for ? – user2569524 Aug 29 '13 at 16:09
  • I think it being used for compiling coffee script but not too sure. I don't use coffee script and never have to use libv8 or rubyracer directly so can't really tell – j03w Aug 29 '13 at 16:13
  • What is in your gemfile? – Deej Aug 29 '13 at 17:37
  • @David .. its gem 'therubyracer','0.10.1' – user2569524 Aug 29 '13 at 17:39
  • Also another thing would be worthwhile specifying what OS your on and what version of Rails you are running. – Deej Aug 29 '13 at 17:41
  • @David OS : Debian 64 , rails version : 3.2.14 – user2569524 Aug 29 '13 at 17:42

1 Answers1

1

In response to the following quote:

Can we edit the gemfile.lock to remove "therubyracer (0.10.1)"

No we cannot. Dependent on what OS you are on you can do the following:

$gem uninstall libv8 
$gem install therubyracer

I have a rails application that I recently did and I too was running Rails 3.2.14 and had the following:

group :assets do
  gem 'therubyracer', :require => 'v8'
  gem 'less-rails'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

Should you go with this second method please before you add this asset block to your gemfile. Delete your Gemfile.lock and then add the asset block to the Gemfile, save it and run bundle update

Deej
  • 5,334
  • 12
  • 44
  • 68
  • but will uninstalling libv8 cause any other problem ? what is it used for basically ? – user2569524 Aug 29 '13 at 17:53
  • @user2569524 in short have a look at this - https://github.com/cowboyd/libv8 :). Quote: `"A gem for distributing the v8 runtime libraries and headers in both source and binary form."` and I believe it shouldn't. So try and uninstall libv8 then gem install therubyracer and execute whatever it was you we're trying. Should this not work copy my `asset` block I provided you and then **delete** your `gemfile.lock` and run a `bundle update` – Deej Aug 29 '13 at 17:55
  • sure will give this a try and will let you know what i get. Thanks a lot :) – user2569524 Aug 29 '13 at 18:02