bundle install issue with libv8 and rails

2019-01-19 21:13发布

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?

6条回答
该账号已被封号
2楼-- · 2019-01-19 21:27

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.

查看更多
聊天终结者
3楼-- · 2019-01-19 21:36

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.

查看更多
Explosion°爆炸
4楼-- · 2019-01-19 21:38

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.

查看更多
我欲成王,谁敢阻挡
5楼-- · 2019-01-19 21:42

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}`
查看更多
再贱就再见
6楼-- · 2019-01-19 21:44

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.

查看更多
霸刀☆藐视天下
7楼-- · 2019-01-19 21:45

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"

查看更多
登录 后发表回答