无法安装therubyracer宝石

时间:2014-08-08 14:00:18

标签: ruby-on-rails ruby gem install therubyracer

我单独安装了 libv8 gem,但是当我尝试安装therubyracer gem时,我收到以下错误:

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

        /usr/bin/ruby extconf.rb
checking for main() in -lpthread... yes
Warning! Unable to load libv8 ~> 3.16.14.
*** 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}/
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby
    --with-pthreadlib
    --without-pthreadlib
    --enable-debug
    --disable-debug
extconf.rb:32:in `<main>': undefined method `configure_makefile' for Libv8:Module (NoMethodError)


Gem files will remain installed in /home/thecodehitman/ruby/gems/gems/therubyracer-0.12.1 for inspection.
Results logged to /home/thecodehitman/ruby/gems/gems/therubyracer-0.12.1/ext/v8/gem_make.out

不确定该怎么做。

1 个答案:

答案 0 :(得分:1)

试试这个:

$ sudo gem install therubyracer --platform ruby

尝试使用或不使用sudo。

如果它是Ruby on Rails应用程序,请包含以下行:

gem 'therubyracer', :platform=>:ruby

在Gemfile中。