简体   繁体   中英

Bundle Install / TheRubyRacer gem cannot be installed on MacOS Catalina 10.15.2

I'm getting tired of error when trying to bundle install and install therubyracer. I've tried everything from around the net and nothing helps. Already installed libv8 and x-code setup. Appreciate your help!

After command sudo gem install therubyracer -v '0.12.3' , I'm receivin error:

    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 ```

I've found the solution for this error. If you have a problem with bundle install check this:

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

It works for me, after few hours of fighting with every solution I can find. Hope it'll help someone.

I was stuck on the same issue and got help from this 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

I am using macOS Catalina version 10.15.3 and ruby version 2.6.3. I hope it helps!

I have faced the same issue recently in 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

Note: while installing ruby race it installed only after putting both the options together --with-system-v8 and --with-v8-dir and pointing to that directory. Please do verify if the folder exist in that path or not before installing.

Uninstalling v8 and install v8@3.15 on a fresh Catalina install worked for me.

$ brew uninstall v8
$ brew install v8@3.15

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM