2013-06-27 55 views
13

所以這是我嘗試在我的Windows安裝libv8:libv8需要蟒蛇2安裝在以建設 - 視窗

D:\projects\perfstats>gem install libv8 
Fetching: libv8-3.16.14.1.gem (100%) 
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. 

     D:/Ruby193/bin/ruby.exe extconf.rb 
creating Makefile 
The system cannot find the path specified. 
The system cannot find the path specified. 
The system cannot find the path specified. 
D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/builder.rb:49:in `setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently not available (RuntimeError) 
     from D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/builder.rb:35:in `block in build_libv8!' 
     from D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/builder.rb:34:in `chdir' 
     from D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/builder.rb:34:in `build_libv8!' 
     from D:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.1/ext/libv8/location.rb:24:in `install!' 
     from extconf.rb:7:in `<main>' 

我安裝Python 2.7版,並將其添加到路徑:

D:\projects\perfstats>python -V 
Python 2.7.3 

任何想法可能是這種情況下的解決方案?

+2

你重新啓動實例*修改'PATH'之後,在頂部示例*中使用了'cmd.exe'? – Aya

+0

是的,我記得這一點。 – user2192677

+1

我對Ruby一無所知,但看着[類似的問題](http://stackoverflow.com/questions/16514758/gem-install-libv8-version-3-11-8-17-on-ruby-windows) ,它看起來不適合在Windows上工作。 'which python2 2>&1>/dev/null'是非常特定於Unix的。 – Aya

回答

6

我在嘗試在Windows上安裝therubyracer gem時出現同樣的問題。

嘗試安裝GitHub的包therubyracer_for_windows並複製v8.dll & v8preparser.dll到您的ruby\bin文件夾。

這也將安裝libv8 gem並應解決您的問題。

+1

獲取v8_context.rb:2:在'require'中:無法加載這樣的文件 - v8(LoadError)在運行'rails server'時。 此外,我沒有在Gemfile.lock中看到libv8 –

+0

鏈接已關閉! –

+0

@miparnisari修復了鏈接。 –

14

有一些變通方法來解決這個問題 嘗試運行此:創業板安裝libv8 -v「3.16.14.1」 - --with系統-V8

或者我們他們分開這樣

group :production do 
gem 'libv8', '~> 3.11.8.3' 
gem 'therubyracer', :platform => :ruby 
end 

然後在Gemfile中運行bundle命令: 捆綁安裝開發或 捆綁安裝--without生產

+2

我從devkit提示符運行它,它工作 – coderman