`gem install therubyracer` fails on Mac OS X Lion

后端 未结 11 572
再見小時候
再見小時候 2020-12-04 07:33

I would appreciate some help in getting gem install therubyracer to work. Here is the error:

$ gem install therubyracer
Building native extensio         


        
11条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 08:16

    But, why is this happening, you ask? And why does uninstalling libv8 and reinstalling therubyracer fix the problem?

    The answer is at the bottom of the error message (from orig post). Ignore the stuff about

    probably lack of necessary libraries and/or headers
    

    This is an incorrect assumption by whoever wrote that error message. At the bottom, you see what Ruby has to say about it:

    undefined method `include_path' for Libv8:Module
    

    In my case, I was trying to install therubyracer-0.9.8 with bundle install, and for some reason, it was trying to use my copy of libv8-3.11.8.13, which had been installed at some point, probably as a dependency of some other gem.

    I don't know why it was trying to use the newer version, because therubyracer.gemspec contains s.add_dependency "libv8", "~> 3.3.10". And my Gemfile.lock says to use libv8 (3.3.10.2). But alas, that is indeed what was happening.

    And it's true that Libv8:Module does not have the method include_path in libv8-3.11.8.13, but it does in libv8-3.3.10.2

    So that is why uninstalling all of your versions of libv8 and then re-installing therubyracer works. Because all the versions of libv8 that do not have the method include_path are removed completely, and the libv8 that does have the method include path is reinstalled when you reinstall of therubyracer.

提交回复
热议问题