Skip to content

Mac therubyracer 安装

Reyes Yang edited this page Nov 7, 2018 · 1 revision

Rails 老项目 bundle 安装 gems 过程中,错误如下。

Installing therubyracer 0.12.1 with native extensions
Building native extensions.  This could take a while...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/reyesyang/Documents/project/alibaba/cibn-client-cms/.bundle/gems/therubyracer-0.12.1/ext/v8
/Users/reyesyang/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20181107-32232-63k4s9.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.

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=/Users/reyesyang/.rbenv/versions/2.3.1/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
/Users/reyesyang/Documents/project/alibaba/cibn-client-cms/.bundle/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of
V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location

thanks,
The Mgmt

解决方法:

brew install v8@3.15
brew link v8@3.15 --force
bundle -V