在MacOSXLion上发生`gem install therubyracer`错误怎么办?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (12)

以下是错误:

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

        /Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for main() in -lobjc... 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
    --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=/Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-objclib
    --without-objclib
extconf.rb:15:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)

以下是我在错误发生之前运行的一些步骤

$ gem install libv8
$ brew install v8

我的环境是:

  • MacOSX Lion 10.7.4
  • Ruby1.9.3p194
  • V8 版本3.9.24
提问于
用户回答回答于

这对我有效:

$ gem uninstall libv8
$ gem install therubyracer

用户回答回答于
gem uninstall libv8
brew install v8
gem install therubyracer

扫码关注云+社区