【问题标题】:Bundle Install / TheRubyRacer gem cannot be installed on MacOS Catalina 10.15.2Bundle Install / TheRubyRacer gem 无法在 MacOS Catalina 10.15.2 上安装
【发布时间】:2020-04-11 13:14:55
【问题描述】:

在尝试捆绑安装和安装 therubyracer 时,我已经厌倦了错误。 我已经尝试了网络上的所有内容,但没有任何帮助。 已经安装了 libv8 和 x-code 设置。 感谢您的帮助!

在命令sudo gem install therubyracer -v '0.12.3' 之后,我收到错误:

    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20191219-41979-115mu26.rb extconf.rb
checking for -lpthread... yes
checking for -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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
    --with-pthreadlib
    --without-pthreadlib
    --with-objclib
    --without-objclib
    --enable-debug
    --disable-debug
    --with-v8-dir
    --without-v8-dir
    --with-v8-include
    --without-v8-include=${v8-dir}/include
    --with-v8-lib
    --without-v8-lib=${v8-dir}/lib
/Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version  (Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.

However, your system version of v8 could not be located.

Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
    from /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
    from extconf.rb:32:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/therubyracer-0.12.3/mkmf.log

extconf failed, exit code 1 ```

【问题讨论】:

  • 您找到解决方案了吗?我尝试使用 brew 安装 v8 并运行 bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8@3.15) 但我仍然遇到与您相同的错误
  • 是的,我找到了。在下面检查我的答案。

标签: ruby-on-rails ruby error-handling rubygems bundler


【解决方案1】:

我已找到解决此错误的方法。 如果您对bundle install 有疑问,请查看:

gem list libv8 --remote --all
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/Users/YOUR_NAME/homebrew/opt/v8@3.15

经过几个小时与我能找到的所有解决方案的斗争,它对我有用。 希望它会帮助某人。

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,并从这个gist 获得了帮助。

    brew install v8@3.15
    gem install libv8 -v 'YOUR_VERSION' -- --with-system-v8
    gem install therubyracer -v 'YOUR_VERSION' -- --with-v8-dir=/usr/local/opt/v8@3.15
    bundle install
    

    我使用的是 macOS Catalina 版本 10.15.3 和 ruby​​ 版本 2.6.3。希望对你有帮助!

    【讨论】:

    • 我不确定区别,但我的自制软件没有遵循其他解决方案的安装模式......但确实遵循了你的。所以,可以肯定地说,无论 v8 安装在哪里……这就是您需要的路径。感谢您的帮助!
    【解决方案3】:

    我最近在 Mac OS 10.15.7 中遇到了同样的问题

    brew install v8-315 
    gem install libv8 -v '3.16.14.19' -- --with-system-v 
    gem install therubyracer -v '0.12.3' -- --with-system-v8 --with-v8-dir=/usr/local/opt/v8@3.15
    

    注意:在安装 ruby​​ race 时,只有在将两个选项放在一起 --with-system-v8 和 --with-v8-dir 并指向该目录后才安装它。 请在安装之前验证该文件夹是否存在于该路径中。

    【讨论】:

      【解决方案4】:

      卸载 v8 并在全新的 Catalina 安装上安装 v8@3.15 对我有用。

      $ brew uninstall v8
      $ brew install v8@3.15
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-03-25
        • 2020-02-14
        • 1970-01-01
        • 2020-07-15
        • 2020-10-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多