Ive just encountered an error when I tried to execute a bundle install or bundle update command on my Windows. Some of these errors are the ff:
- Installing libv8 with native extensions… Failed to build gem native extension
- libv8 requires python 2 to be installed in order to build ..blah blah blah…
- Could not find therubyracer …
See below sample of an error.
Installing libv8 (184.108.40.206) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. C:/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. C:/ruby193/lib/ruby/gems/1.9.1/gems/libv8-220.127.116.11/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 C:/ruby193/lib/ruby/gems/1.9.1/gems/libv8-18.104.22.168/ext/libv8/builder.rb:35:in `block in build_libv8!' from C:/ruby193/lib/ruby/gems/1.9.1/gems/libv8-22.214.171.124/ext/libv8/builder.rb:34:in `chdir' from C:/ruby193/lib/ruby/gems/1.9.1/gems/libv8-126.96.36.199/ext/libv8/builder.rb:34:in `build_libv8!' from C:/ruby193/lib/ruby/gems/1.9.1/gems/libv8-188.8.131.52/ext/libv8/location.rb:24:in `install!' from extconf.rb:7:in `' Gem files will remain installed in C:/ruby193/lib/ruby/gems/1.9.1/gems/libv8-184.108.40.206 for inspection. Results logged to C:/ruby193/lib/ruby/gems/1.9.1/gems/libv8-220.127.116.11/ext/libv8/gem_make.out An error occurred while installing libv8 (18.104.22.168), and Bundler cannot continue. Make sure that `gem install libv8 -v '22.214.171.124'` succeeds before bundling.
To fix the problem, there are 2 ways that you can try.
1) Try to run this command:
gem install libv8 -v '126.96.36.199' -- --with-system-v8
2) Or, you will separate them in the Gemfile.
group :production do gem 'libv8', '~> 188.8.131.52' gem 'therubyracer', :platform => :ruby end # And then run the bundle command: bundle install --without production or bundle install development
And it should be working now!