无法在JRuby中安装therubyracer

时间:2012-01-24 21:02:50

标签: ruby linux jruby rvm

我已经安装了RVM,然后是Jruby,这是我输入的版本:jruby -v:

jruby 1.6.5.1(ruby-1.8.7-p330)(2011-12-27 1bf37c2)(Java HotSpot(TM)Client VM 1.7.0_02)[linux-i386-java]

问题是我无法安装therubyracer gem,当我尝试通过jruby -S gem install therubyracer安装时,我得到了这个:

/usr/local/rvm/rubies/jruby-1.6.5.1/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very we$
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
Checking for Python...Unable to build libv8: Python not found!
*** 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}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/rvm/rubies/jruby-1.6.5.1/bin/jruby

我还尝试使用--1.9参数,强制使用另一个ruby版本,但无论如何都失败了。即使我尝试安装libv8,但我得到了同样的错误。

有什么想法吗? 我有CentOS 5.7

3 个答案:

答案 0 :(得分:7)

您需要Ruby Rhino

答案 1 :(得分:1)

只是澄清一下,在你的Gemfile中它是:

gem 'therubyrhino'

跟随命令行:

jruby -S bundle install

答案 2 :(得分:1)

我遇到了同样的问题,但在Gemfile中定义therubyrhino并没有解决我的问题,Bundler一直试图安装libv8。

发生这种情况是因为我在Gemfile中定义了twitter-bootstrap-rails gem,它依赖于较少的gem(取决于therubyracer),所以我改变了较少的gem以使用不依赖于较少的静态分支(如关于https://github.com/seyhunak/twitter-bootstrap-rails/issues/22)问题的建议:

gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"