gpt4 book ai didi

ruby-on-rails - 使用 Ruby On Rails 4.2.5.1 我可以 gem install therubyracer 但 bundle 在 OS X 10.11.1 上失败

转载 作者:行者123 更新时间:2023-12-04 18:01:03 27 4
gpt4 key购买 nike

在 OS X 10.11.1 上的 Ruby 2.3.0 环境中使用 rbenv 使用“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

我尝试过的一些事情:

发件人:How to install therubyracer gem on 10.10 Yosemite?

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 install tries to use cache file

添加到 ~/.bundle/config

BUNDLE_PATH: .bundle
BUNDLE_DISABLE_SHARED_GEMS: "1"

我也试过这个:

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

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

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

最佳答案

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

“我无法使上述任何解决方案正常工作(或者更确切地说,我能开始工作的一切都需要我团队的其他成员重新 bundle )。然而,从 rbenv 切换到 RVM 后, bundle 安装运行顺利。”

我尝试从 rbenv 切换到 RVM,它运行良好。我现在可以“bundle ”并且 therubyracer gem 可以完美安装。

关于ruby-on-rails - 使用 Ruby On Rails 4.2.5.1 我可以 gem install therubyracer 但 bundle 在 OS X 10.11.1 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35419256/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com