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

一曲冷凌霜 提交于 2019-11-28 15:27:30

This steps worked for me.

OS: Maverick Ruby: 2.1.1

gem uninstall libv8
gem install therubyracer -v '0.11.3'
gem install libv8 -v '3.11.8.13' -- --with-system-v8

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.

Nikhil

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

gem uninstall libv8
gem install therubyracer
gem install libv8 -- --with-system-v8

Tertom's solution posted on github solved it for me, after having tried all other solutions proposed on the respective github issue and here.
I had the exact same system configuration.
This is on el capitan, so not an exact answer to the question, but people might find this info helpful.

I'm citing it here for visibility:

Solved the same problem

  • MacOS 10.11.2
  • ruby 1.9.3
  • libv8 3.16.14.13
  • therubyracer 0.12.2

--

brew tap homebrew/versions  
brew install v8-315  
brew link --force v8-315  
bundle install  
brew unlink v8-315

If you also cannot install libv8,

gem install libv8 --with-system-v8

or

bundle config build.libv8 --with-system-v8

The above answers did not work for me; my bundler config has disable-shared-gems enabled which causes additional issues.

I'm using Yosemite 10.10.1, Rails 3.2.x, and Ruby 1.9.3p550.

The following snippet in my bin/setup has fixed the issue for me.

if ! bundle show therubyracer; then
    bundle config build.libv8 --with-system-v8
    gem install --install-dir vendor/bundle libv8 -v 3.16.14.7
    gem install libv8 -v 3.16.14.7
    gem install --install-dir vendor/bundle therubyracer 
fi

I found a workaround to the above problem.

This is more of a compatibility among libv8 and therubyracer.

gem install libv8 -v '3.3.10.4' -- --with-system-v8

gem install therubyracer -v '0.10.2'

This should work fine as both the versions are compatible with me. Initially I was trying to install the version 0.12.0 for therubyracer and was facing the issue. Once I switched to version 0.10.2, everything worked fine.

My current OS: Mavericks

I've got this issue for MacOS Mojave 10.14.2 and I was able to fix this issue when I found where package v8-315 was installed and what the folder name was. In my case, it was here /usr/local/opt/v8@3.15.

To fix this, I've run next:

brew install v8-315
gem install libv8 -v '3.16.14.15' -- --with-system-v
gem install therubyracer -v '0.12.2' -- --with-system-v8 --with-v8-dir=/usr/local/opt/v8@3.15
bundle install

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

rvm install 2.2.2
gem install rails
bundle install

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.

I just run bundle update, and it worked for me.

Obs.: Using Ruby 2.3.0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!