解决 libv8 安装失败问题、therubyracer 安装失败问题(CenterOS、MAC、ubuntu)

1.在安装 gem ‘therubyracer’ 报错了
首先是libv8报错

Installing libv8 3.16.14.19 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. and
the fact that we don’t need and probably you don’t need therubyracer.

There are two solutions for the above error:
向上方的报错、或者是 提示我runing gem install libv8 --source… 这些

按照自带提示安装了一下、没好用。
1.以下解决方案

gem install libv8 -v ‘3.16.14.3’ – --with-system-v8
这个安装后到是好用了、但是出现了其他错误:

Installing therubyracer 0.12.3 with native extensions
therubyracer -v ‘0.12.3’ – --with-v8-dir=… 这样的错误

国内百度了一下,除了删除gem 缓存就没有其他解决方案了,这很不好。

我这里归档了一些系统的解决方案(CenterOS、MAC、Ubuntu)

MAC方案1.我的解决方案 macOS 10.15 系统
这里使用你自己的版本号

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

方案2:

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

方案3

brew install v8@3.15
bundle config --local build.libv8 --with-system-v8
bundle config --local build.therubyracer --with-v8-dir=/usr/local/opt/v8@3.15
bundle install

Center OS系统环境:(Ubuntu也可以这么干但是不用去掉gem)
顺便提一下:我在centerOS环境没有解决该问题(以上方法全部试过了)
经过2天的查阅,我注视了
#gem ‘execjs’
#gem ‘therubyracer’, :platforms => :ruby
采用了 sudo yum install nodejs ,也可以解决生产对js依赖(nodejs可以替代他们,很多人推荐使用nodejs 而不是 他俩)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值