Error installing libv8: ERROR: Failed to build gem native extension

后端 未结 16 1062
不思量自难忘°
不思量自难忘° 2020-11-27 09:21

I made a rails project with,

rails new test_bootstrap.

succeeded.

moved to the project dir and added the gems

gem \         


        
相关标签:
16条回答
  • 2020-11-27 09:26

    My issue wasn't related with therubyracer at all just libv8 gem and as @rishav-bhardwaj pointed --with-system-v8 didn't do the trick, instead i had to exec

    bundle update

    then

    bundle install

    and finally

    Bundle complete!

    The error is gone!

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. An error occurred while installing libv8 (3.16.14.7), and Bundler cannot continue. Make sure that `gem install libv8 -v '3.16.14.7'` succeeds before bundling.

    0 讨论(0)
  • 2020-11-27 09:26

    In my case I resolved this situation by requiring 'mini_racer', '~> 0.2.6' in my Gemfile

    Then bundle install command worked.

    0 讨论(0)
  • 2020-11-27 09:28

    i feel this has less to do with libv8 and more to do with therubyracer.

    i received your same error while running a bundle install on a rails app. if you have encountered this similarly, try installing the gem outside of bundle like so:

    gem install therubyracer

    then run bundle install. i hope this works for you too.

    0 讨论(0)
  • 2020-11-27 09:31

    With homebrew this helps me to solve this error.

    brew tap homebrew/versions
    brew install v8-315
    
    gem install libv8 -v '3.16.14.13' -- --with-system-v8
    gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
    
    bundle install
    

    Seen on rubyracer Github issues.

    0 讨论(0)
  • 2020-11-27 09:33

    I was also unable to install this gem instead of using

    --with-system-v8
    

    once try to do bundle update which worked fine for me

    0 讨论(0)
  • 2020-11-27 09:37

    How to resolve libv8/therubyracer issue

    I encountered similar issue in which after installing libv8, error occurs installing therubyracer. Here is my solution:

    $ gem install libv8 -v '3.16.14.3' -- --with-system-v8
       
    $ bundle install
    

    -- see error installing therubyracer --

    $ gem uninstall libv8
    
    $ brew install v8
    
    $ gem install therubyracer
    
    $ bundle install
    

    -- see error installing libv8 --

    $ gem install libv8 -v '3.16.14.3' -- --with-system-v8
    
    0 讨论(0)
提交回复
热议问题