Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gem install libv8 --version '3.11.8.17' on ruby (windows)

The problem is as following.

Error installing libv8:
ERROR: Failed to build gem native extension.

    D:/Ruby193/bin/ruby.exe extconf.rb
    creating Makefile
    The system can not find the specified path

        D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/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.11.8.17/ext/libv8/builder.rb:35:in 'block in build_libv8!'
             from D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'chdir'
             from D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'build_libv8!'
             from D:Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'install!'
             from extconf.rb:7: in '<main>'
I have installed the python27 and add the path.

python --version
Python 2.7.4

Then I check the code as following.

 def setup_python!
      # If python v2 cannot be found in PATH,
      # create a symbolic link to python2 the current directory and put it
      # at the head of PATH. That way all commands that inherit this environment
      # will use ./python -> python2
      if python_version !~ /^2/
        unless system 'which python2 2>&1 > /dev/null'
          fail "libv8 requires python 2 to be installed in order to build, but it is currently #{python_version}"
        end
        `ln -fs #{`which python2`.chomp} python`
        ENV['PATH'] = "#{File.expand_path '.'}:#{ENV['PATH']}"
      end
    end

I tried to install the Linux command line to windows so that the 'ln -fs' should be working.But the problem still can not be solved.

like image 879
user2318042 Avatar asked May 13 '13 04:05

user2318042


3 Answers

Try this:

gem install libv8 -v '3.11.8.17' -- --with-system-v8

This error was a pain untill I run the above command :)

like image 159
sergioviniciuss Avatar answered Sep 29 '22 07:09

sergioviniciuss


Try with https://github.com/eakmotion/therubyracer_for_windows. I had solved same problem on my windows machine using this solution.

like image 24
Vieenay Siingh Avatar answered Sep 29 '22 09:09

Vieenay Siingh


Follow these steps:

  1. Get suitable Python from here http://python.org/download/
  2. Set path with this command SET PATH=<ruby directory>;<python directory> (e.g. SET PATH=C:\Ruby192\bin;C:\Python27)

And now install your desire gem

gem install libv8

Got this solution from here.

I wonder if you are getting this error for version. Try this:

gem install libv8 --version 3.11.8.0 
like image 37
rony36 Avatar answered Sep 29 '22 09:09

rony36