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

8

45

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.

Absinthe answered 13/5, 2013 at 4:13 Comment(3)
hi.. it very tricky to add libv8 liberey Window because window does not support the libv8 . same problem with me so i switch to linux/Ubuntu .Farmhand
Thank you very much, i will change to linux.Absinthe
that's not actual solution to the problem though... @iscube1Glenine
R
166

Try this:

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

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

Rapine answered 6/9, 2013 at 0:30 Comment(15)
Awesome Periback! After spent some hours googling...I got install libv8 using your suggested command. Thanks!Tweezers
Glad I could help! it was also a pain for me, @Romans8.38-39 . By the way, did you succeed to setup the environment on Windows?Rapine
Yes, I setup the environment on Windows 7 HP 64bit :)Tweezers
You just saved me a WHOLE lot of bother. Kudos.Raceme
I had to change the version number to 3.16.14.3 for it to work. Hope it helps someone.Craiova
Thanks Periback. Halfway there... (I now have a moan about a system V8 not being installed!!). IMO it's a shocking disgrace that this stuff doesn't work properly on the most popular operating system in the world.Inseverable
This solution is not windows specific. Worked on OSX too.Privily
Glad it worked for you too, @Alain. I think this is an usual problem for windows users, but it's the first time I hear about this problem happening also for mac users..Rapine
This saved me hours of troubleshooting - I even thought of reinstalling Ruby, but this worked perfectly :).Coca
This error was giving me such a headache, but this command fixed it. Thanks!Ainslee
If you don't have a system v8 library installed, you might find that installing Node ensures that you have one installed.Evora
First, go to devkit and run devkitvars.bat and this solved the problem for me too !Faqir
Thanks! It still works, Win7-64, and using top from @FaqirCanikin
Also - heads up - windows likes to have the platform specified ... you can make it even easier by using $ gem install INSERT_GEM_NAME --platform x86-mswin32-60 help.rubygems.org/kb/rubygems/installing-gems-with-no-networkEndowment
worked for version 3.16.14.19 - thanks a lot!Antiperspirant
L
12

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

Larcener answered 14/5, 2013 at 21:52 Comment(1)
github.com/eakmotion/therubyracer_for_windows/blob/master/… new linkCutwater
P
4

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 
Puff answered 25/6, 2013 at 20:49 Comment(1)
Installing 3.11.8.0 succeed, but gem install libv8 (with or without --version 3.11.8.17) doesn't :(Sumo
M
2

Be sure that you can actually run the "which" command on your system. It's not native to Windows.

"which" should be installed if you installed DevKit or RailsInstaller. However, I am running into this problem too (I also have a number of versions of python installed and working), and just discovered that my which command under DevKit... (and the one under RailsInstaller...) is not actually working.

The windows near equivalent is "where". So you should run "WHERE which" to find out if/where you have the "which" command on your system.

That doesn't make 'therubyracer' work, or issues with libv8 go away, but it is part of the puzzle.

(I've posted the problem to the msysGit folks to see what they say about the non-executing 'which' command.)

Monochromatism answered 4/2, 2014 at 2:16 Comment(0)
J
1

This error is about a libv8-3.11.8.17\ext\libv8\builder.rb script. On line 60 we can see this code:

`python -c 'import platform; print(platform.python_version())'`.chomp

This is a wrong python command syntax in Windows. You should use a double quotes, like this:

`python -c "import platform; print(platform.python_version())"`.chomp

After fixing this script, you should run gem install with "-l" (use local only) key. If you don't, gem will download a script with an error again.

Jacobsohn answered 29/7, 2015 at 5:31 Comment(0)
P
0

I could be reading this wrong, but I think the problem is this line:

unless system 'which python2 2>&1 > /dev/null'

It's looking for python2 when in fact the command for python is simply python.

Perhaps try aliasing python to python2.

Prolongation answered 13/5, 2013 at 4:30 Comment(2)
Doesn't works, and I've also tried to remove the setup_python! function alltogether. The main problem is in the which python command for which there is no equivalent in windows.Cloistered
The ruby devkit has "which" and probably you'll have it on your path anyway to build libv8. But this installer is extremely frustrating to install on Windows and might just trip up further along for some other reason.Counsel
U
0

do: gem install rmagick -v '2.13.2'

and then do: gem install libv8 -v 3.11.8.17 -- --with-system-v8

Uralite answered 5/3, 2015 at 13:57 Comment(0)
C
0

These are the following steps I have to take to get therubyracer to work on windows:

1) Install Python 2.7

2) Go here here https://github.com/eakmotion/therubyracer_for_windows and follow instructions

3) comment therubyracer gem in the Gemfile & Run Bundle install

#gem 'therubyracer'

4) Uncomment gem therubyracer in the Gemfile & Run Bundle install

gem 'therubyracer'
Cutwater answered 5/8, 2015 at 1:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.