therubyracer - Gem::Ext::BuildError: ERROR: Failed to build gem native extension

前端 未结 14 1758
抹茶落季
抹茶落季 2020-12-07 11:09

I\'m trying to install the following gem versions on Mavericks

  • libv8 (3.16.14.3)
  • therubyracer (0.12.1)

Obviously therubyracer gems depe

相关标签:
14条回答
  • 2020-12-07 11:12

    For those facing this problem in OS X El Capitan, this solution from a therubyracer issue thread was what finally worked for me:

    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
    

    I had also run brew install gcc prior, but I'm not sure whether this was in fact necessary.

    0 讨论(0)
  • 2020-12-07 11:12

    Try first uninstalling libv8 gem, then install rubyracer, and then libv8

    gem uninstall libv8
    gem install therubyracer
    gem install libv8 -- --with-system-v8
    
    0 讨论(0)
  • 2020-12-07 11:12

    I noticed that when we encounter a problem:

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension
    

    You should then install build-essential

    sudo apt install build-essential
    

    It works for me with mini_race's installation problems.

    0 讨论(0)
  • 2020-12-07 11:13

    In my Case

    MacOS: Catalina, Ruby: 2.3.3, Using rbenv (not RVM), I Required therubyracer version : 0.12.3 (Does not matter)

    I tried all the solution but what worked for me, Dear pls do not blindly copy paste solution (bcz I did in my case), first read and then change the versions in the below commands if you need any. Most of the commands are common in most of the exisiting answers but what worked for me gem install therubyracer -- --with-v8-dir=$(brew --prefix v8-315) instead of gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315 Thanks to Junji Zhi for his comment in this answer

    1. brew install gcc
    2. brew tap homebrew/versions   (If it wont work then below 2 steps, for latest MacOS version)
    2.a. brew tap brewsci/bio
    2.b. brew tap brewsci/science
    3. brew install v8-315     (uninstall if v8 installed previously without '-315')
    4. gem install libv8 -v '3.16.14.19' -- --with-system-v8   (Be careful with the libv8 version mentioned in this command, replace version number with one required)
    5.a. gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315    (If it does not work then try below one, In my case below command worked)
    5.b. gem install therubyracer -- --with-v8-dir=$(brew --prefix v8-315)
    

    Done, then continue with your bundle install

    Note: While gem install therubyracer, check for which version of libv8 is being installing, if it is diffrent than what i mentioned in the step 4 then, your therubyracer may not install, so just do one thing, gem uninstall libv8 then repeat step-4 by changing the version, what you can see in the console while installing therubyracer

    0 讨论(0)
  • 2020-12-07 11:14

    After breaking my head for almost two days this worked for me.

    rvm install 2.2.2
    gem install rails
    bundle install
    
    0 讨论(0)
  • 2020-12-07 11:18

    For all of you out there using macOS 10.15, brew has has changed so you will need to do these commands.

    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
    
    0 讨论(0)
提交回复
热议问题