16

So this is how I try to install libv8 on my Windows:

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>'

I installed python 2.7 and added it to the path:

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

Any ideas what could be the solution in this case?

user2192677
  • 327
  • 1
  • 5
  • 12
  • 2
    Did you restart the instance of `cmd.exe` used in the top example *after* modifying `PATH`? – Aya Jun 27 '13 at 15:08
  • yes I remembered about this. – user2192677 Jun 27 '13 at 15:11
  • 1
    I know nothing about Ruby, but looking at [a similar question](http://stackoverflow.com/questions/16514758/gem-install-libv8-version-3-11-8-17-on-ruby-windows), it looks like it's not designed to work on Windows. The `which python2 2>&1 > /dev/null` is very Unix-specific. – Aya Jun 27 '13 at 15:18
  • You shouldn't need the libv8 gem, that's generally only needed for platforms that don't include a JS engine out-of-the-box (Windows does). Can you post your Gemfile? – PinnyM Jun 27 '13 at 17:22

2 Answers2

28

There are some work-around to fix the problem Try to run this: gem install libv8 -v '3.16.14.1' -- --with-system-v8

Or we separate them in the Gemfile like this

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

And then run the bundle command: bundle install development or bundle install --without production

Arman Ortega
  • 3,003
  • 1
  • 30
  • 28
7

I had the same problem trying to install the therubyracer gem on Windows.

Try installing the GitHub package therubyracer_for_windows and copy the v8.dll & v8preparser.dll into your ruby\bin folder.

This will also install the libv8 gem and should solve your issue.

Martin Buberl
  • 45,844
  • 25
  • 100
  • 144