JohnMerlino
JohnMerlino

Reputation: 3928

the therubyracer gem keeps causing bundle install to fail on ubuntu 12.04

I'm trying to use capistrano to deploy, and it fails because of a rubyracer gem issue.

I tried adding the following variants to gemfile and then deploying to a production server on ubuntu and nothing works:

1)
gem 'libv8', '3.11.8.3'

3)
gem 'therubyracer'
gem 'libv8', '3.3.10.4'

4)
gem 'libv8', '~> 3.11.8.3'

It all gives the same error:

An error occured while installing therubyracer (0.11.0), and Bundler cannot continue. Make sure that gem install therubyracer -v '0.11.0' succeeds before bundling.

So I try this instead:

group :production do
  gem 'therubyracer', '0.10.2', :platforms => :ruby
end

But that causes this error:

Bundler could not find compatible versions for gem "libv8":
 In Gemfile:
  therubyracer (= 0.10.2) ruby depends on
  libv8 (~> 3.3.10) ruby
 libv8 (3.11.8.3)

It seems I currently have two version of lib8 on server:

libv8 (3.11.8.4, 3.3.10.4 x86_64-linux)

Any ideas?

Upvotes: 2

Views: 4602

Answers (4)

duytan
duytan

Reputation: 51

After hours of trying solutions from stackoverflow, I got an easy fix from this site with just 2 commands, the author mentioned that

When installing therubyracer gem you may run into this problem on a fresh machine install.

http://usefulprogrammingshit.drmcnasty.com/?p=12

sudo apt-get install g++
sudo apt-get install build-essential

I know nothing of ruby so you would need to research more about this solution, but after all, "therubyracer 0.12.2" is installed on ubuntu 14.04. I hope it could help.

Upvotes: 5

Siwei
Siwei

Reputation: 21557

  1. try node.js as your runtime javascript environment, but not libv8.

  2. if you insist on libv8, don't specify the version. it seems that there's conflicts on the versions. e.g. in your Gemfile:

    gem 'therubyracer'
    gem 'libv8'
    

Upvotes: 0

przbadu
przbadu

Reputation: 6049

Just uninstall both libv8 from your machine

Terminal

gem uninstall libv8

In terminal, You will be prompt to select which version do you want to uninstall like this:

  1. libv8 3.3.10.4 x86_64-linux
  2. libv8 3.11.8.4 x86_64-linux
  3. All

Select 3 and hit enter(return key). It will uninstall your both libv8 versions installed in your machine.

Now, in your Gemfile just include therubyracer without libv8 and bundle install

gem 'therubyracer'
bundle install

It will work

Upvotes: 1

Michael Durrant
Michael Durrant

Reputation: 96544

At the command line of the production server do

gem install therubyracer

Upvotes: 0

Related Questions