2

我在 Windows Server 2012 R2 上安装 therubyracer 时遇到问题。

首先,我尝试过gem install therubyracer -v '0.12.3'

这给出了这个输出:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.

    C:/Ruby200/bin/ruby.exe extconf.rb
checking for main() in -lpthread... no
checking for v8.h... no
*** 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=C:/Ruby200/bin/ruby
        --with-pthreadlib
        --without-pthreadlib
        --enable-debug
        --disable-debug
        --with-v8-dir
        --without-v8-dir
        --with-v8-include
        --without-v8-include=${v8-dir}/include
        --with-v8-lib
        --without-v8-lib=${v8-dir}/
C:/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.17/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version  (Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.

However, your system version of v8 could not be located.

Please make sure your system version of v8 that is compatible
with 3.16.14.17 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.17/lib/libv8.rb:7:in `configure_makefile'
        from extconf.rb:32:in `<main>'


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.3 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.3/ext/v8/gem_make.out

也试过gem install therubyracer -v '0.12.3' -- --with-v8-dir

这导致了这个输出:

Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-v8-dir'
This could take a while...
ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.

    C:/Ruby200/bin/ruby.exe extconf.rb --with-v8-dir
checking for main() in -lpthread... no
*** 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=C:/Ruby200/bin/ruby
        --with-pthreadlib
        --without-pthreadlib
        --enable-debug
        --disable-debug
        --with-v8-dir
C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:1665:in `dir_config': undefined method `split' for true:TrueClass (NoMethodError)
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.17/ext/libv8/location.rb:49:in `configure'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.17/lib/libv8.rb:7:in `configure_makefile'
        from extconf.rb:32:in `<main>'


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.3 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.3/ext/v8/gem_make.out

如果您需要任何进一步的信息,请告诉我。

4

1 回答 1

2

提供的错误意味着您尚未安装 g++。

我认为您需要先运行以下命令:

 sudo apt-get install g++
于 2017-03-16T10:08:51.907 回答