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

前端 未结 14 1767
抹茶落季
抹茶落季 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: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

提交回复
热议问题