试图安装libv8,"无法构建gem原生扩展"

cor*_*rat 12 ruby rubygems ruby-on-rails ruby-on-rails-3

我使用的是W7 64bit.简单地说,当我进入:

C:\Sites>gem install libv8
Run Code Online (Sandbox Code Playgroud)

我得到这个结果:

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

    C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile
which: no gmake in ("my PATH is here, and as far as I know it should include everything I need")
/usr/bin/env: python: No such file or directory
C:\RailsInstaller\DevKit\bin\make.EXE: *** [out/Makefile.ia32] Error 127
Using compiler: C:\RailsInstaller\DevKit\mingw\bin\g++.EXE
GYP_GENERATORS=make \
    build/gyp/gyp --generator-output="out" build/all.gyp \
                  -Ibuild/standalone.gypi --depth=. \
                  -Dv8_target_arch=ia32 \
                  -S.ia32 -Dhost_arch=ia32


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/libv8-3.11.8.3 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.1
1.8.3/ext/libv8/gem_make.out
Run Code Online (Sandbox Code Playgroud)

卸载并重新安装不起作用.

我正在尝试安装libv8,因为它是twitter-bootstrap-rails的依赖项.

编辑:正如我所说,我在Windows上,我现在意识到此错误中列出的文件路径为/ usr/bin/env.这太奇怪了.

Hug*_*ans 19

解决方案是安装版本.0

gem install libv8 --version 3.11.8.0
Run Code Online (Sandbox Code Playgroud)

直到这个问题得到解决,我也经历过这一点

  • 寻找这个答案的其他人:不时的libv8都不会在windows上编译.只需将版本更改为某些早期版本,然后等待修复程序可用.大多数宝石都试图不依赖于这个libv8,但似乎有时它只是意外地被拉入. (2认同)

小智 8

我遇到了这个问题,上面的@xiy让我得到了答案.不得不改变

gem 'therubyracer'
Run Code Online (Sandbox Code Playgroud)

gem 'therubyracer', :platforms => :ruby
Run Code Online (Sandbox Code Playgroud)

因为Windows不需要或不喜欢那个宝石.


ste*_*own 1

我遇到了与您描述的相同的 Windows 问题:

gem 'twitter-bootstrap-rails'
Run Code Online (Sandbox Code Playgroud)

当我从 github 切换版本时:

gem 'twitter-bootstrap-rails', :github => 'seyhunak/twitter-bootstrap-rails'
Run Code Online (Sandbox Code Playgroud)

没问题。试一试。

  • gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git' 是正确的行 (3认同)