加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails-3 – Rails:安装rubyracer时出错

发布时间:2020-12-17 02:20:57 所属栏目:百科 来源:网络整理
导读:我在我的linode服务器上运行’bundle install’.但是无法安装 rubyracer的原因. Bundle安装输出是: Installing therubyracer (0.11.0) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb
我在我的linode服务器上运行’bundle install’.但是无法安装 rubyracer的原因. Bundle安装输出是:

Installing therubyracer (0.11.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb 
checking for main() in -lpthread... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason,probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
/usr/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in `build_with_rubygem_libv8': undefined local variable or method `libv8_include_flags' for main:Object (NameError)
from extconf.rb:20:in `<main>'


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0/ext/v8/gem_make.out

An error occurred while installing therubyracer (0.11.0),and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.11.0'` succeeds before bundling.

实际上安装了gem ruby??racer,但版本是0.11.4.我只是不知道为什么它不采用这个版本并且只接受0.11.0.

另外如何安装0.11.0.当我运行错误“gem install therubyracer -v’0.11.0’”中给出的命令时,它无法执行并给出:

Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
checking for main() in -lpthread... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason,probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
/usr/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in    `build_with_rubygem_libv8': undefined local variable or method `libv8_include_flags' for    main:Object (NameError)
from extconf.rb:20:in `<main>'


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/therubyracer-    0.11.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0/ext/v8/gem_make.out

这里有人可以帮忙吗?在堆栈和git上搜索了很多但是没有一个给定的解决方案工作.

我的gemfile:

source 'https://rubygems.org'

gem 'rails','3.2.12'
gem "paperclip"
gem 'mysql2'
gem "devise"
group :assets do
 gem 'sass-rails','~> 3.2.3'
 gem 'coffee-rails','~> 3.2.1'

gem 'uglifier','>= 1.0.3'
end


gem 'jquery-rails'
gem 'libv8','3.11.8.4',:platform => :ruby
gem 'therubyracer','0.11.0',:platforms => :ruby
gem 'rails_admin'
gem 'unicorn'
gem 'delayed_job_active_record'
gem 'daemons'

解决方法

我在ubuntu上面临同样的问题:

经过一些实验,我能够确认命令行上的’gem install therubyracer –pre’工作正常,但告诉bundler使用–pre选项不起作用:

bundle config build.therubyracer --pre

我不知道是不是因为gem是通过依赖而不是Gemfile中明确的’gem’行引入的.即使经过广泛的谷歌搜索,我也无法解决这个问题,但由于0.11似乎只有几个小时的历史,我决定尝试通过添加以下内容恢复到之前的0.10版本:

gem 'therubyracer','=0.10'

在使用依赖它的宝石之前.这个强制捆绑器选择了早期版本,它像魅力一样安装.希望有人能尽快修复0.11.

在github上查看therubyracer的问题之后,这似乎与两个不同的问题有关 – 一个关闭:https://github.com/cowboyd/therubyracer/issues/213建议首先(或显式)安装libv8 gem,并导致不同的错误:https://github.com/cowboyd/therubyracer/issues/215,但尚未关闭 – 对于64位目标,libv8 gem似乎有一个损坏的二进制文件.唯一的解决方案似乎是从源代码构建libv8,或者像我一样做,并恢复到0.11beta8或更早(有??人说0.11beta8工作).在那之前,我建议你在Github上观看215问题并等待修复.

谢谢.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读