Srikanth Chilukuri
Srikanth Chilukuri

Reputation: 573

Unable to install therubyracer-heroku gem for ruby on rails on windows?

I want to install the gem for ruby and rails in windows. I have tried the below command.

gem install therubyracer-heroku -v '0.8.1.pre3'

I am unable to install, got the below error.

D:\Ruby\demo_app>gem install therubyracer-heroku -v '0.8.1.pre3' Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing therubyracer-heroku: ERROR: Failed to build gem native extension.

D:/RailsInstaller/Ruby1.9.2/bin/ruby.exe extconf.rb The system cannot find the path specified. extconf.rb failed Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options:

    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=D:/RailsInstaller/Ruby1.9.2/bin/ruby extconf.rb:9:in `<main>': Error compiling V8 (RuntimeError) Compiling V8

Gem files will remain installed in D:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/therubyracer-heroku-0.8.1.pre3 for inspection. Results logged to D:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/therubyracer-heroku-0.8.1.pre3/ext/v8/gem_make.out

Upvotes: 1

Views: 1848

Answers (1)

Luis Lavena
Luis Lavena

Reputation: 10378

Both therubyracer and therubyracer-heroku gems are not compatible with Windows.

The gems require libv8 be compiled for the platform which hasn't been tackled by the gem developers (yet or maybe never will happen)

This gem is used as JavaScript engine which then is used by ExecJS and Rails to minify and perform other tasks on top of your JavaScript.

Windows already have a JavaScript engine (cscript) which is available in the PATH. ExecJS will detect it.

What you need to do is ensure therubyracer or therubyracer gem are not installed under Windows.

Since most likely you're using Bundler, in your Gemfile you will require to define a platform (and a environment if you haven't) to tell Bundler not to install the gem under Windows.

Please look at platform option inside Bundler documentation on how to use it.

One example will be:

group :production do
  gem "therubyracer-heroku", :platforms => [:ruby]
end

Hope that helps.

Upvotes: 1

Related Questions