简体   繁体   中英

bundle install issue with libv8 and rails

I'm having issues with the libv8 gem with ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]. gem install libv8 works fine and I have

gem 'therubyracer'

in my Gemfile and this has a dependency on libv8 which is installed when I do a bundle install :

$ bundle exec gem list

*** LOCAL GEMS ***

actionmailer (3.1.3)
actionpack (3.1.3)
...
libv8 (3.3.10.4 x86_64-darwin-10)
...

but when I run:

$ rails s
Could not find libv8-3.3.10.4 in any of the sources
Run `bundle install` to install missing gems.

it can't find libv8 - is this is a 32/64 bit issue? If so, how do I solve it?

Another solution is to use nodejs instead of therubyracer. You install it on the server using apt-get/yum, so there's no need for your Gemfile to include execjs or therubyracer.

I had a similar problem deploying from an x86 dev box to an x86_64 server (using capistrano)

When I did the deployment, I got the same 'Could not find libv8-3.3.10.4 in any of the sources' message. This is because running 'bundle pack' on an x86 machine only copies the x86 gem into the /vendor/cache directory!

I fixed this by explicitly adding the linux x86_64 gem file to the /vendor/cache directory, so that it would agree with the deployment server architecture. Deployment ran fine after that.

You can actually install that version on Mavericks:

gem install libv8 -v 3.11.8.17 -- --with-system-v8

You can provide whatever libv8 gem version you want to install ..

After this you might facing issue with installing therubyracer then

Update Version of Gemfile to point to the last version like so:

gem "therubyracer", "~> 0.10.2"

and I was able to successfully install the gem.

If you want to manually install the gem, you can use:

gem install therubyracer --version "~> 0.10.2"

I suspect this was because I had a 32/64 bit mismatch.

I solved this with the following:

$ irb
ruby-1.9.3-p0 :001 > `gem list`.each_line {|line| `sudo env ARCHFLAGS="-arch x86_64" gem install #{line.split.first}`

I resolved this issue by installing nodejs (latest version). What it does is that it installs the libv8 -dev library along with it. Thus rather than installing the gem what you require is the native library.

You can install it directly or install nodejs as well in your system and the above error should be resolved.

Have you tried bundle exec rails s ? It's possible that there's a conflict between the gems you have installed on your system and the gems that are required for your project to run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM