【问题标题】:Can't install libv8 3.11.8.17 in Rails on Windows无法在 Windows 上的 Rails 中安装 libv8 3.11.8.17
【发布时间】:2013-06-21 14:12:52
【问题描述】:

无法安装 libv8 3.11.8.17 gem。我已经环顾四周,发现它不支持 Windows。虽然我仍在寻找解决方法?

Installing libv8 (3.11.8.17)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-            
3.11.8.17/ext/libv8/builder.rb:49:in `setup_python!': libv8 requires python 2 to b
e installed in order to build, but it is currently not available (RuntimeError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-
3.11.8.17/ext/libv8/builder.rb:35:in `block in build_libv8!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-
3.11.8.17/ext/libv8/builder.rb:34:in `chdir'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-
3.11.8.17/ext/libv8/builder.rb:34:in `build_libv8!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-
3.11.8.17/ext/libv8/location.rb:24:in `install!'
from extconf.rb:7:in `<main>'

Gem files will remain installed in 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-
3.11.8.17/ext/libv8/gem_make.out
An error occurred while installing libv8 (3.11.8.17), and Bundler cannot
continue.
Make sure that `gem install libv8 -v '3.11.8.17'` succeeds before bundling.

我没有尝试使用 therubyracer,老实说,我不知道什么 gem 依赖于 libv8。安装 Python27 和设置 PATH 没有做任何事情。除了换平台还能做什么?或者,https://github.com/hiranpeiris/therubyracer_for_windows 提供的 v8.dll 有一个我似乎没有掌握的解决方法?

【问题讨论】:

  • 补充:我和其他开发者一起工作,他们在 OS X 上并且可能没有这个问题,所以删除 libv8 可能不是一个选项:/

标签: ruby-on-rails windows-7 gem ruby-1.9.3 libv8


【解决方案1】:

试试这个

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

从这里回答

Error installing libv8: ERROR: Failed to build gem native extension

【讨论】:

  • 谢谢这解决了我的问题
【解决方案2】:

我只在我的 Linux 环境中在 prod 上使用 libV8 和 TheRubyRacer。我在 Gemfile 中将它们分开:

group :production do
 gem 'libv8', '~> 3.11.8.3'
 gem 'therubyracer', :platform => :ruby
end

然后我捆绑安装而不生产:

bundle install --without production

(参见 SO 文章:Why does 'bundle' install production gems on my development machine?)

这似乎避免了关于 Windows 的整个 V8 辩论。

【讨论】:

    猜你喜欢
    • 2013-09-09
    • 2013-05-07
    • 1970-01-01
    • 1970-01-01
    • 2013-10-08
    • 1970-01-01
    • 1970-01-01
    • 2015-12-25
    • 1970-01-01
    相关资源
    最近更新 更多