0

I have this problem while installing rails on Windows 10. I have tried to many things but none of them worked. Please help!!!
This is what I have done. It looks like I have two errors.
ERROR: Failed to build gem native extension.
You have to install development tools first.

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\Perdorues>ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]

C:\Users\Perdorues>gem -v
2.6.10

C:\Users\Perdorues>gem install rails --no-rdoc --no-ri
Fetching: i18n-0.8.1.gem (100%)
Successfully installed i18n-0.8.1
Fetching: thread_safe-0.3.6.gem (100%)
Successfully installed thread_safe-0.3.6
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: concurrent-ruby-1.0.5.gem (100%)
Successfully installed concurrent-ruby-1.0.5
Fetching: activesupport-5.0.2.gem (100%)
Successfully installed mini_portile2-2.1.0
Fetching: nokogiri-1.7.0.1-x64-mingw32.gem (100%)
Nokogiri is built with the packaged libraries: libxml2-2.9.4, libxslt-1.1.29, zlib-1.2.8, libiconv-1.14.
Successfully installed nokogiri-1.7.0.1-x64-mingw32
Fetching: loofah-2.0.3.gem (100%)
Successfully installed loofah-2.0.3
Fetching: rails-html-sanitizer-1.0.3.gem (100%)
Successfully installed rails-html-sanitizer-1.0.3
Fetching: rails-dom-testing-2.0.2.gem (100%)
Successfully installed rails-dom-testing-2.0.2
Fetching: builder-3.2.3.gem (100%)
Successfully installed builder-3.2.3
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: actionview-5.0.2.gem (100%)
Successfully installed actionview-5.0.2
Fetching: actionpack-5.0.2.gem (100%)
Successfully installed actionpack-5.0.2
Fetching: activemodel-5.0.2.gem (100%)
Successfully installed activemodel-5.0.2
Fetching: arel-7.1.4.gem (100%)
Successfully installed arel-7.1.4
Fetching: activerecord-5.0.2.gem (100%)
Successfully installed activerecord-5.0.2
Fetching: globalid-0.3.7.gem (100%)
Successfully installed globalid-0.3.7
Fetching: activejob-5.0.2.gem (100%)
Successfully installed activejob-5.0.2
Fetching: mime-types-data-3.2016.0521.gem (100%)
Successfully installed mime-types-data-3.2016.0521
Fetching: mime-types-3.1.gem (100%)
Successfully installed mime-types-3.1
Fetching: mail-2.6.4.gem (100%)
Successfully installed mail-2.6.4
Fetching: actionmailer-5.0.2.gem (100%)
Successfully installed actionmailer-5.0.2
Fetching: nio4r-2.0.0.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/nio4r-2.0.0/ext/nio4r
C:/Ruby23-x64/bin/ruby.exe -r ./siteconf20170312-10676-aq6a8o.rb extconf.rb
checking for unistd.h... *** 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:/Ruby23-x64/bin/$(RUBY_BASE_NAME)
C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to    generate an executable file. (RuntimeError)
You have to install development tools first.
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
    from extconf.rb:5:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/nio4r-2.0.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/nio4r-2.0.0 for inspection.
Results logged to C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/nio4r-2.0.0/gem_make.out
4
  • 1
    it would be helpful if you could list the things you've tried. On windows I'd recommend using something like railsinstaller.org/en or even a virtual environment like a vagrant box.
    – bork
    Commented Mar 12, 2017 at 11:01
  • Is there a solid reason why you are not preferring to use the de facto rails installer for Windows?
    – arjun
    Commented Mar 12, 2017 at 13:38
  • Have you installed the development kit from rubyinstaller.org/downloads? FWIW: rubyinstaller.org/downloads also recommends using 2.2.X installers and states that the "64-bit versions of Ruby are relatively new on the Windows area and not all the packages have been updated to be compatible with it.'
    – orde
    Commented Mar 12, 2017 at 19:06
  • I tried also to install it from link, it shows me this: C:\Sites>gem install bundler Fetching: bundler-1.14.6.gem (100%) Successfully installed bundler-1.14.6 Parsing documentation for bundler-1.14.6 Installing ri documentation for bundler-1.14.6 Done installing documentation for bundler after 28 seconds 1 gem installed C:\Sites>rails -v The system cannot find the path specified. @bork
    – Enxhi
    Commented Mar 12, 2017 at 20:27

1 Answer 1

-1

When using ruby on Windows with I presume ruby installer you should also install ruby development kit. I think this will solve your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.