4

我终于用 gem install libv8 -- --with-system-v8 在我的 Windows 上安装了 libv8

现在,当我尝试安装 therubyracer 时,我得到了

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

        C:/Ruby193/bin/ruby.exe extconf.rb --with-system-v8
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:/Ruby193/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:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You hav
e chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location

thanks,
The Mgmt

我想知道这个错误信息的真正含义是什么?我也查了这个https://github.com/cowboyd/libv8#bring-your-own-v8 如何为 v8 安装标头?

4

3 回答 3

3

当我遇到这个问题时,我发现我在开发中不需要那些 gem,因为 rails 用来预编译你的资产,所以我的解决方案非常简单,

宝石文件

gem "rails"

group :production do
  gem 'therubyracer'
end

然后当你捆绑运行这个命令

$ bundle install --without production

然后对生活微笑:D

于 2013-10-01T23:56:59.243 回答
2

在 Mac 上,您可以尝试使用自制软件更新 v8 库:

gem uninstall libv8
brew install v8
gem install therubyracer

更新:抱歉,没有意识到这是一个仅限 Windows 的问题。

于 2013-10-30T19:10:04.327 回答
1

@Aalap

我在 Windows 7 64 位上设置我的 Ruby on Rails Web 应用程序时遇到了同样的问题。我遇到了这个解决方案。这有点旧,但解决了问题。该解决方案提供了“therubyracer”gem 文件和要安装的 v8.dll 库。上面的链接上的说明非常清楚。

我安装了“libv8”gem,就像Periback 在 SO 上的回答一样,当我尝试安装“therubyracer”gem 时,它失败并出现与你相同的错误。现在我的 Web 应用程序运行良好,我的“gem list”命令显示:

libv8 (3.11.8.13)

therubyracer (0.11.0beta1 x86-mingw32)

希望这可以帮助。

于 2014-05-22T11:45:58.150 回答