3

在 OS X 10.11.1 上将 rbenv 用于 Ruby 2.3.0 环境我无法在使用“bundle”时安装 therubyracer Gem。

这是成功的:

> gem install therubyracer
Building native extensions.  This could take a while...
Successfully installed therubyracer-0.12.2
Parsing documentation for therubyracer-0.12.2
Done installing documentation for therubyracer after 0 seconds
1 gem installed

在我的 Gemfile 中:

gem 'therubyracer', '0.12.2', platforms: :ruby

这失败了:

> bundle
Installing therubyracer 0.12.2 (was 0.12.1) with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/jsidlosky/code/sentons/websocket-rails-demo/.bundle/gems/therubyracer-0.12.2/ext/v8
/Users/jsidlosky/.rbenv/versions/2.3.0/bin/ruby -r     ./siteconf20160215-9105-1s1s0pv.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** 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.
....
To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Users/jsidlosky/code/sentons/websocket-rails-demo/.bundle/extensions/x86_64-darwin-15/2.3.0-static/therubyracer-0.12.2/mkmf.log

mkmf.log 文件的错误是:

conftest.c:3:10: fatal error: 'v8.h' file not found

我尝试过的一些事情:

来自:如何在 10.10 Yosemite 上安装 therubyracer gem?

git clone https://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake clean build binary
gem install pkg/libv8-3.16.14.13.gem

来自:捆绑安装尝试使用缓存文件

添加到 ~/.bundle/config

BUNDLE_PATH: .bundle
BUNDLE_DISABLE_SHARED_GEMS: "1"

我也试过这个:

bundle config build.libv8 --with-system-v8

我现在已经花了 5 个多小时从各种 StackOverflow 问题和其他网站尝试其他随机想法。到目前为止,即使“gem install therubyracer”工作得非常完美,也没有什么能让我在“bundle”中工作的 therubyracer。

我将非常感谢任何指示或解决方案。

4

1 回答 1

1

它来自以下评论:github.com/cowboyd/therubyracer/issues/359

“我无法让上述任何解决方案发挥作用(或者更确切地说,我能开始工作的一切都需要我的团队的其他成员重新捆绑)。然而,从 rbenv 切换到 RVM 后,bundle install 运行时没有一个障碍。”

我尝试从 rbenv 切换到 RVM 并且效果很好。我现在可以“捆绑”并且 therubyracer gem 可以完美安装。

于 2016-02-15T22:01:39.697 回答