2
votes

Getting error while trying to install Ruby on Rails like below command

Praveen@PraveenLaptop MINGW64 ~
$ gem install rails --no-ri --no-rdoc

ERROR: Error installing rails:

ERROR: Failed to build gem native extension.

current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/nio4r-2.2.0/ext/ni o4r

C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20180224-8176-ibolzo.rb extconf.rb

current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/nio4r-2.2.0/ext/nio4r make "DESTDIR=" clean 'make' is not recognized as an internal or external command, operable program or batch file.

current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/nio4r-2.2.0/ext/nio4r make "DESTDIR=" 'make' is not recognized as an internal or external command, operable program or batch file.

make failed, exit code 1

Gem files will remain installed in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/nio4r- 2.2.0 for inspection. Results logged to C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0 /nio4r-2.2.0/gem_make.out Temporarily enhancing PATH for MSYS/MINGW... Building native extensions. This could take a while...

Can anyone figure out what is the problem of getting this error

2
Do you have Ruby development kit installed?Anon
Yes I have installed. Actually I followed this blog.teamtreehouse.com/installing-rails-5-windowsPRAVEEN KUMAR
@PRAVEENKUMAR including everything here? "Now we need to make the DevKit tools available to Ruby."Joe

2 Answers

1
votes

What the error is saying is that it can't find make. If you have MSYS2 already installed, make sure you add the location where MSYS2 is installed is in your PATH environment variable.

Alternatively, you can run ridk install if you do not have (or want to reinstal) MSYS2 so that it can be used by ruby.

1
votes

Follow those steps, actually, I have installed Ruby on Rails to many windows machine using these steps.

Step 1: Download Git BASH as the BASH emulation behaves just like the "git" command in LINUX and UNIX environments.

Step 1.1: Download and install latest NodeJS from here and check the NodeJS version

$ node -v
#=> v6.11.5 # or something like this

Step 2: Download the ruby latest version here and install it in your directory. Check the Ruby version

$ ruby -v
#=> ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32]
# or something like this

Step 3: Download Devkit here take the suitable one for matching your windows bit like 32 or 64 bit

Step 4: Create a devkit folder inside Ruby directory that means where created a default directory after installing ruby software, something like this disk (:C) or (:D)/Ruby25/devkit/

Step 5: Extract the DevKit file inside the devkit folder

Step 6: Open your GIT BASH inside the devkit folder and run this two commands

$ ruby dk.rb init
$ ruby dk.rb install

if above command running properly then done.

Step 7: Now you can run rails command for installing inside ruby folder

 $ gem install rails

Step 8: Check the Rails version

 $ rails -v
 #=> Rails 5.0.6

if till now all are steps is ok? that's it, now run rails command and create a rails project, like

$ rails new project
 create
    create  README.md
    create  Rakefile
    create  config.ru
    create  .gitignore
    create  Gemfile
    create  app
    create  app/assets/config/manifest.js
    ............

Hope it helps