therubyracer gem 未在 MAC OS Monterey 上安装和 libv8

问题描述 投票:0回答:1

我正在使用新的 MACBook PRO(芯片:Apple M2)并尝试设置 Rails 应用程序,但 rubyracer gem 未安装。我尝试了以下步骤,但没有成功

brew install [email protected]
gem install libv8 -v '3.16.14.19' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/opt/homebrew/opt/[email protected]

当我尝试使用“brew install [电子邮件受保护]”时,出现以下错误

Warning: [email protected] has been deprecated because it depends on Python 2 to build!
Error: [email protected]: no bottle available!
If you're feeling brave, you can try to install from source with:
  brew install --build-from-source [email protected]
It is expected behaviour that most formulae will fail to build from source.
It is expected behaviour that Homebrew will be buggy and slow when building from source.
Do not create any issues about failures building from source on Homebrew's GitHub repositories.
Do not create any issues building from source even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help building from source from MacHomebrew on Twitter.
You may ask for help building from source in Homebrew's discussions but are unlikely to receive a response.
If building from source fails, try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

按照命令“brew install --build-from-source [email protected]”的建议安装 v8 后,therubyracer gem 仍未安装,

thrrubyracer错误日志:

Building native extensions with: '--with-v8-dir=/opt/homebrew/opt/[email protected]'
This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

    current directory: /Users/rashmib/.rvm/gems/ruby-2.7.0/gems/therubyracer-0.12.3/ext/v8
/Users/rashmib/.rvm/rubies/ruby-2.7.0/bin/ruby -I /Users/rashmib/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0 -r ./siteconf20221117-7943-1tz6m31.rb extconf.rb --with-v8-dir\=/opt/homebrew/opt/[email protected]
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:

    ...
    
/Users/rashmib/.rvm/gems/ruby-2.7.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 /Users/rashmib/.rvm/gems/ruby-2.7.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:

  /Users/rashmib/.rvm/gems/ruby-2.7.0/extensions/-darwin-21/2.7.0/therubyracer-0.12.3/mkmf.log

extconf failed, exit code 1

知道如何解决这个问题吗?

ruby-on-rails ruby macos therubyracer libv8
1个回答
0
投票

有人解决这个问题了吗?很抱歉问了一个问题。谢谢你

© www.soinside.com 2019 - 2024. All rights reserved.