2012-03-08 110 views
1

在运行捆绑安装的命令,我遇到了以下错误宝石:无法安装therubyracer

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

D:/RailsInstaller/Ruby1.9.2/bin/ruby.exe extconf.rb 

* 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=D:/RailsInstaller/Ruby1.9.2/bin/ruby Checking for Python...Unable to build libv8: Python not found!

Gem files will remain installed in D:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9 .1/gems/libv8-3.3.10.4 for inspection. Results logged to D:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/libv8-3.3 .10.4/ext/libv8/gem_make.out An error occured while installing libv8 (3.3.10.4), and Bundler cannot continue.

Make sure that gem install libv8 -v '3.3.10.4' succeeds before bundling.

环境:红宝石1.9.2的Rails 3.2.1宝石:1.8.17 的Gemfile

source 'https://rubygems.org' 

    gem 'rails', '3.2.1' 

    gem 'sqlite3' 

    gem "heroku" 

    group :production do 
     gem 'pg' 
    end 

    gem 'execjs' 
    gem 'therubyracer' 
    gem 'libv8', '3.3.10.4' 


    group :assets do 
     gem 'sass-rails', '~> 3.2.3' 
     gem 'coffee-rails', '~> 3.2.1' 
     gem 'uglifier', '>= 1.0.3' 
    end 

    gem 'jquery-rails' 

有人可以告诉我为什么我看到这个错误,以及如何解决它?

+0

可能重复[therubyracer宝石在Windows](http://stackoverflow.com/questions/6356450/therubyracer-gem-on-windows) – 2014-06-18 07:10:05

回答

2

你做gem install libv8 -v '3.3.10.4'

您也可以尝试安装Python。对于mac看http://www.python.org/getit/mac/

+0

我试过这个,但我得到同样的错误,它寻找Python。 – 2012-03-09 02:28:04

+0

基本上,我想将我的应用程序上传到Heroku。但是,Java脚本并未在Heroku环境中编译所以,我已经为Gemfile,gem'execjs'和gem'therubyracer'添加了一些宝石。 execjs gem安装正确,'therubyracer'gen未安装,出现上述错误。 – 2012-03-09 03:06:39

+0

如果宝石单独安装,然后给'捆绑安装',上述问题得到解决。 – maniempire 2013-09-05 07:14:37