如果能帮助我让gem install therubyracer
正常工作,我将不胜感激。下面是错误:
$ 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
我的环境是:
发布于 2012-06-06 06:28:53
这对我很有效:
$ gem uninstall libv8
$ gem install therubyracer
发布于 2012-12-18 07:31:35
gem uninstall libv8
brew install v8
gem install therubyracer
发布于 2013-05-25 00:09:32
但是,你会问,为什么会发生这种情况?为什么卸载libv8
并重新安装therubyracer
就能解决这个问题?
答案在错误消息的底部(来自orig post)。忽略有关的内容
probably lack of necessary libraries and/or headers
无论是谁写了这条错误消息,这都是一个错误的假设。在底部,您可以看到Ruby对此有什么看法:
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:Module
在libv8-3.11.8.13
中没有include_path
方法,但在libv8-3.3.10.2
中有
这就是为什么卸载所有版本的libv8
,然后重新安装therubyracer
的原因。因为所有不具有方法include_path
的libv8
版本都会被完全删除,并且在重新安装therubyracer
时会重新安装具有方法include
路径的libv8
。
https://stackoverflow.com/questions/10905820
复制相似问题