use*_*724 5 rubygems ruby-on-rails-3 therubyracer
我正在我的 linode 服务器上运行“捆绑安装”。但无法安装 rubyracer 的原因。捆绑安装输出为:
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.
Run Code Online (Sandbox Code Playgroud)
实际上安装了 gem rubyracer 但版本是 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
Run Code Online (Sandbox Code Playgroud)
这里有人可以帮忙吗?在堆栈和 git 上搜索了很多,但没有一个给定的解决方案有效。
我的宝石文件:
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'
Run Code Online (Sandbox Code Playgroud)
我在ubuntu上也遇到同样的问题:
经过一些实验,我能够确认gem install therubyracer --pre命令行上的“”工作正常,但告诉捆绑程序使用该--pre选项不起作用:
bundle config build.therubyracer --pre
Run Code Online (Sandbox Code Playgroud)
我不知道这是否是因为 gem 是通过依赖项而不是 Gemfile 中显式的“gem”行引入的。即使经过大量的谷歌搜索,我也无法解决这个问题,但由于 0.11 似乎只有几个小时的历史,我决定尝试0.10通过添加以下内容来恢复到以前的版本:
gem 'therubyracer', '=0.10'
Run Code Online (Sandbox Code Playgroud)
在使用依赖于它的 gem 之前。这迫使捆绑程序选择早期版本,并且它安装得非常顺利。希望someone will fix 0.11尽快。
在 github 上查看 therubyracer 的问题后,这似乎与两个不同的问题有关 - 一个已关闭: https: //github.com/cowboyd/therubyracer/issues/213,建议首先(或显式)安装 libv8 gem,以及这会导致不同的错误:https://github.com/cowboyd/therubyracer/issues/215,并且尚未关闭 - libv8 gem 似乎有一个针对 64 位目标的损坏的二进制文件。唯一的解决方案似乎是从源代码构建 libv8 或像我一样并备份到 0.11beta8 或更早版本(有人说0.11beta8可行)。在此之前,我建议您查看 Github 上的 215 问题并等待修复。
谢谢。