安装 libv8 时出错:错误:无法构建 gem 本机扩展 [英] Error installing libv8: ERROR: Failed to build gem native extension

查看:26
本文介绍了安装 libv8 时出错:错误:无法构建 gem 本机扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个 Rails 项目,

rails 新的 test_bootstrap.

成功.

移动到项目目录并添加 gems

宝石therubyracer"gem "less-rails" #Sprockets(Rails 3.1 用于其资产管道的内容)支持 LESS宝石推特引导轨道"

然后运行

捆绑安装

在那之后,我有这个错误.

安装 libv8 (3.16.14.3)Gem::Installer::ExtensionBuildError: 错误:无法构建 gem 本机扩展.c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb创建 Makefile지정된 경로를 찾을 수 없습니다.지정된 경로를 찾을 수없습니다.지정된 경로를 찾을 수 없습니다.c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/builder.rb:58:in `setup_python!': libv8 需要python 2要安装才能构建,但目前不可用(RuntimeErr或)来自 c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/builder.rb:42:in `block in build_libv8/builder.rb:42:in `block in build_libv8!'来自 c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/builder.rb:40:在`chdir'来自 c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/builder.rb:40:in`build_libv8!'来自 c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:24:在`安装!'来自 extconf.rb:7:in `<main>'Gem 文件将保持安装在 c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3 用于检查.结果记录到 c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/gem_make.out安装 libv8 (3.16.14.3) 时出错,Bundler 无法继续.在捆绑之前确保`gem install libv8 -v '3.16.14.3'` 成功.

对不起一些韩国人.它说,它找不到选择的路径或类似的东西.

我试着运行这个命令

gem install libv8 -v '3.16.14.3'

抛出同样的错误.

解决方案

试试这个:

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

<块引用>

注意:因为libv8是therubyracer使用的V8引擎的接口,您可能需要使用 libv8,即使您已经安装了 V8.如果您希望使用自己的 V8 安装,而不是构建它对于您,请使用 --with-system-v8 选项.

更多内容可以参考libv8 on github

I made a rails project with,

rails new test_bootstrap.

succeeded.

moved to the project dir and added the gems

gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"

and run

bundle install

after that, i have this error.

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

c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile
지정된 경로를 찾을 수 없습니다.                                                          지정된 경로를 찾을 수
없습니다.                                                          지정된 경로를 찾을 수 없습니다.

c:/RailsInstaller/Ruby1.9.3/lib/ruby/ge
ms/1.9.1/gems/libv8-3.16.14.3/ext/libv8/builder.rb:58:in `setup_python!': libv8 requires
python 2 to be installed in order to build, but it is currently not available (RuntimeErr
or) from c:/RailsInstaller/Ruby1.9.
3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/builder.rb:42:in `block in build_lib
v8/builder.rb:42:in `block in build_libv8!'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/lib
v8/builder.rb:40:in `chdir'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/lib
v8/builder.rb:40:in `build_libv8!'
        from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/lib
v8/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/l
ibv8-3.16.14.3 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ex
t/libv8/gem_make.out
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot
continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.

sorry for some Koreans. It says, It can't find the chosen path or something like that.

and i tried to run this command

gem install libv8 -v '3.16.14.3' 

throwing the same error.

解决方案

try this one:

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

Note : Because libv8 is the interface for the V8 engine used by therubyracer, you may need to use libv8, even if you have V8 installed already. If you wish to use your own V8 installation, rather than have it built for you, use the --with-system-v8 option.

For more you can go through the documentation of libv8 on github

这篇关于安装 libv8 时出错:错误:无法构建 gem 本机扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆