首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在Mac OS X Lion上` `gem install theubyracer`失败

在Mac OS X Lion上` `gem install theubyracer`失败
EN

Stack Overflow用户
提问于 2012-06-06 06:21:51
回答 11查看 41.7K关注 0票数 70

如果能帮助我让gem install therubyracer正常工作,我将不胜感激。下面是错误:

代码语言:javascript
复制
$ 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)

以下是我在出现错误之前运行的一些值得注意的步骤。它们工作得很好:

代码语言:javascript
复制
$ gem install libv8
$ brew install v8

我的环境是:

  • Mac OS X Lion 10.7.4
  • ruby 1.9.3p194 (35410-04-20修订版) x86_64-darwin11.4.0
  • V8版本3.9.24 (通过自制软件)
EN

回答 11

Stack Overflow用户

回答已采纳

发布于 2012-06-06 06:28:53

这对我很有效:

代码语言:javascript
复制
$ gem uninstall libv8
$ gem install therubyracer

(非常感谢http://www.ruby-forum.com/topic/4306127)

票数 106
EN

Stack Overflow用户

发布于 2012-12-18 07:31:35

代码语言:javascript
复制
gem uninstall libv8
brew install v8
gem install therubyracer
票数 43
EN

Stack Overflow用户

发布于 2013-05-25 00:09:32

但是,你会问,为什么会发生这种情况?为什么卸载libv8并重新安装therubyracer就能解决这个问题?

答案在错误消息的底部(来自orig post)。忽略有关的内容

代码语言:javascript
复制
probably lack of necessary libraries and/or headers

无论是谁写了这条错误消息,这都是一个错误的假设。在底部,您可以看到Ruby对此有什么看法:

代码语言:javascript
复制
undefined method `include_path' for Libv8:Module

在我的例子中,我试图用bundle install安装therubyracer-0.9.8,出于某种原因,它试图使用我的libv8-3.11.8.13副本,该副本在某个时刻已经安装,可能是其他gem的依赖项。

我不知道为什么它要尝试使用较新的版本,因为therubyracer.gemspec包含s.add_dependency "libv8", "~> 3.3.10"。我的Gemfile.lock说要用libv8 (3.3.10.2)。但天哪,这确实是正在发生的事情。

确实,Libv8:Modulelibv8-3.11.8.13中没有include_path方法,但在libv8-3.3.10.2中有

这就是为什么卸载所有版本的libv8,然后重新安装therubyracer的原因。因为所有不具有方法include_pathlibv8版本都会被完全删除,并且在重新安装therubyracer时会重新安装具有方法include路径的libv8

票数 40
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10905820

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档