简体   繁体   中英

Jekyll installation failure on local mac machine

user@me-MacBook-Pro jekyll-site % sudo bundle exec jekyll serve

Could not find therubyracer-0.12.3 in any of the sources
Run `bundle install` to install missing gems.

Now I run bundle install and it is running without fail until Installing therubyracer 0.12.3 with native extensions . At this step, it is throwing an error:

/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.

and also,

An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.3' --source 'https://rubygems.org/'` succeeds before bundling.

Then as suggested here, I ran the following command:

gem install therubyracer -v '0.12.3' --source 'https://rubygems.org/'

It is giving another error which says:


Using compiler: c++ (clang version 12.0.0)
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Beginning compilation. This will take some time.
Building v8 with env CXX=c++ LINK=c++  /usr/bin/make x64.release ARFLAGS.target=crs werror=no
GYP_GENERATORS=make \
    build/gyp/gyp --generator-output="out" build/all.gyp \
                  -Ibuild/standalone.gypi --depth=. \
                  -Dv8_target_arch=x64 \
                  -S.x64  -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
  CXX(target) /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from ../src/allocation.cc:33:
../src/utils.h:33:10: fatal error: 'climits' file not found
#include <climits>
         ^~~~~~~~~
1 error generated.
make[1]: *** [/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o] Error 1
make: *** [x64.release] Error 2
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
    from /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `each'
    from /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:26:in `install!'
    from extconf.rb:7:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19 for inspection.
Results logged to /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-20/2.5.0/libv8-3.16.14.19/gem_make.out

How can I fix this and run the Jekyll on local machine?

What therubyracer does is provide a nice interface for interpreting JS within ruby. Of course it uses V8 runtime under the hood.

So the key messages in your logs are these:

However, your system version of v8 could not be located.
Unable to find a compiler officially supported by v8.

Compiler

libv8 is a ruby gem which distributes v8 runtime for ruby applications. And as the error message says, it recommends using gcc as a compiler.

So install gcc and try again.

$ brew install gcc

libv8 should be building now and so is therubyracer


System V8

There's another option in case something is still missing: using system installed v8 instead of the one provided with libv8 gem.

For that first make sure you have the V8 installed on your system. It will probably also bring the supported compiler with it as a dependency.

$ brew install v8

And then use --with-system-v8 flag when installing libv8.

$ gem install libv8 -- --with-system-v8

This might be useful if you're planning to use V8 runtime for things other than therubyracer .

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