I'm having trouble installing therubyracer gem on Windows.
Using Ruby 2.1.6 32-bit and running
gem install libv8 -v '3.16.14.3' -- --with-system-v8
This is the error I get:
Installing therubyracer 0.12.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/Ruby21/bin/ruby.exe extconf.rb
checking for main() in -lpthread... no
checking for v8.h... no
*** 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=C:/Ruby21/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in
`configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/therubyracer-0.12.1 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/therubyracer-0.12.1/gem_make.out
An error occurred while installing therubyracer (0.12.1), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.1'` succeeds before bundling.
This is kinda a double edged sword, the libv8 gem itself tries to build v8 and things get crazy because it's using *nix programs to test and setup the environment.
So to fix it you have to use -- --with-system-v8 so it doesn't try to build v8. Unfortunately that advice already presumes you have a copy of v8 somewhere on your system. Which you don't, obviously.
The quick and easy is to install node.js and make sure it gets added to your path, since it is statically compiled the library is in node.exe. There may be some weird errors with that approach, BUT I don't think you will run into any of them.
Of course, in reality you shouldn't need therubyracer or libv8 because Windows ships with JScript which is a JavaScript engine itself, or if nothing else node will also suffice.
Solution from Charles Lowell:
No, there is no way that I know of to currently install this gem on windows. The problem is that there is currently no pre-compiled version of the libv8 gem for Windows, and the source version is only compatible with *nix. It does not necessarily have to be that way, it just requires somebody taking the time to make the compile work for Windows. https://github.com/fractaloop/libv8
That said, Windows should come with a JScript, the Microsoft JavaScript runtime, which rails (via execjs) will automatically detect and use, so you should be able to just remove your dependency on therubyracer.
Related
I have a website developed with was RoR v 4.2.4 on MAC which needs some adaptions and I'm trying to get in running on my windows 10 (because I don't have a MAC).I was not successfull with the rails installer and rails 5.0.
After a lot of pain installing RoR 4.2.4 with ruby 2.2.6 I managed to install nearly all missing gems using bundle check, bundle install and gem install xyz -v 0.0.... But now I'm really stuck with the last 2:
therubyracer and libv8
What I tried:
Install libv8 with gem install libv8 -v 3.16.14.11 -- --with-system-v8 and also the therubyracer-for-windows which is mentioned here.
Modify the gemfile.lock to get rid of the dependencies like:
group :production do
gem 'therubyracer'
end
and tried bundle install --without production. But then I get an error when starting the server.
At the moment bundle check says that therubyracer v 0.12.2 is the last missing gem. libv8 is installed with --with-system-v8. gem list says libv8 (3.16.14.11) and therubyracer (0.11.0b) is installed but the systems does not seems to find therubyracer because: therubyracer -v does not work. Furthermore bundle install give me the follwing error:
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20170122-10664-jwvn48.rb extconf.rb
--with-v8-dir=/usr/local/opt/v8-315
checking for main() in -lpthread... yes
checking for v8.h... no
*** 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=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.11/ext/libv8/location.rb:50:in
`configure': You have chosen to use the version of V8 found on your system
(Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.11 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.11/lib/libv8.rb:7:in
`configure_makefile'
from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/therubyracer-0.12.2 for inspection.
Results logged to
C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/therubyracer-0.12.2/gem_make.out
An error occurred while installing therubyracer (0.12.2), and Bundler cannot
continue.
Make sure that `gem install therubyracer -v '0.12.2'` succeeds before bundling.
This error is at least similar to all the ones I get before, when trying to install therubyracer after I installed libv8 with --with-system-v8.
Sorry if this information is a bit chaotic, but I tried so many things over about a day now and was not always 100% sure what I doing :)...quite hard to summarizes as much as possible. If there is important information missing, let me know.
By the way: I followed this guide as good as possible. Creating/Developping a new website with rails new blog and running the server for it works perfectly...the problem is only with the existing website I have to complete.
Can someone help me? Is there any way to get the website running on my windows pc? Thanks!
When I try running the following command
gem install therubyracer -v '0.12.1'
I am getting the following error. I tried to install libv8, but was not successful then. Can someone please help me out here.
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
C:/software/ruby-1.9.3/bin/ruby.exe extconf.rb
checking for main() in -lpthread... no
checking for v8.h... no
*** 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=C:/software/ruby-1.9.3/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
C:/software/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/libv8-
3.16.14.3/ext/libv8/location.rb:50:in `configure': You have chosen to use
the version of V8 found on your system
(Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from C:/software/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/libv8- 3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
Gem files will remain installed in C:/software/ruby- 1.9.3/lib/ruby/gems/1.9.1/gems/therubyracer-0.12.1 for inspection.
Results logged to C:/software/ruby- 1.9.3/lib/ruby/gems/1.9.1/gems/therubyracer-0.12.1/ext/v8/gem_make.out
I am new to ruby and therefore I am pretty confused what should be done here.
You can't install therubyracer on Windows, see this post.
Since therubyracer is only one of the javascript runtimes compatible with ExecJS, you may try anothers, say node.js for example.
As long as you're developing Ruby on Rails applications, sooner or later you will have to switch to Unix or Linux, so why not now?
Hi here is my console log,
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** 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
--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=/Users/user/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
/Users/user/.rvm/gems/ruby-1.9.3-p448#projVer2.3/gems/libv8-3.16.14.3/ext/libv8 /location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from /Users/user/.rvm/gems/ruby-1.9.3-p448#projVer2.3/gems/libv8-3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.3-p448#projVer2.3/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.3-p448#projVer2.3/gems/therubyracer- 0.12.1/ext/v8/gem_make.out
FDLMC060:helpkit user$
I tried a lot of links which install libv8 via homebrew and then tried to install therubyracer but no help.
and i tried this link as well..
How to install therubyracer gem on 10.10 Yosemite?
but throwed errors while installing v8 itself.
The switch --with-system-v8 installs the libv8
but its not installing therubyracer -v '0.12.0'
OS -> OS X Yosemite
installed apple-gcc 4.2
and made export on CC,CXX
Please Help me to fix this.
Try to
gem install therubyracer -v '0.12.0' -- --with-v8-dir=/path/to/v8
But before you should have v8 installed on your system
Thanks #Stanislav for trying to help me.
I exactly did this at last,
Uninstalled all libv8 related gems using
"gem uninstall libv8 -a -x"
and then removed the Gemfile.lock using "rm -rf Gemfile.lock"
and tried
"bundle install"
it worked!!!!
i tried installing the gem separately and v8 file also. I'm lost on what to do as I've exhausted all possible options
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/giowong/.rbenv/versions/2.1.3/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** 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=/Users/giowong/.rbenv/versions/2.1.3/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/therubyracer-0.12.1/gem_make.out
An error occurred while installing therubyracer (0.12.1), and Bundler cannot
continue.
Make sure that `gem install therubyracer -v '0.12.1'` succeeds before bundling.
I'm using brew to install ruby and rails using this setup guide
https://gorails.com/setup/osx/10.10-yosemite
Help please, upgrading to Yosemite has totally messed with my dev environment
Perhaps this problem has to do with a recent update of XCode. After a XCode update you need to do the following steps:
Open Xcode and accept the license agreement
Reinstall the Command Line Tools.
The second step seems to depend on your OS versions. If xcode-select --install does not work try to start the Install Command Line Developer Tools app in /System/Library/CoreServices.
After reinstalling the Command Line Tools try to rerun bundle install.
Try this worked for me:
gem install libv8 -- --with-system-v8
gem install therubyracer -v '0.12.1'
if that didn't work try to run:
brew update
and try again the first two steps.
I resolved the same issue by changing the Gemfile
gem 'therubyracer'
was replaced by
gem 'therubyracer', platforms: :ruby
Could you try this?
This worked for Catalina
brew install v8#3.15
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8#3.15
Source
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
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.