3

I'm here on Windows 7 x64 and am trying to install Ruby on Rails from scratch. I just installed the RubyInstaller 1.9.3-p429 and now just ran the DevKit-tdm-32-4.5.2-20111229-1559-sfx. After doing ruby dk.rb install --force. I tried to test if it's setup correctly but run into:

c:\DevKit>gem install RedCloth --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
The system cannot find the path specified.
ERROR:  Error installing RedCloth:
        ERROR: Failed to build gem native extension.

        C:/Ruby193/bin/ruby.exe extconf.rb
checking for main() in -lc... no
creating Makefile


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.9 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out

And this happens to all gems that need the Devkit. I guess I have to set the path specified but I have no idea what that means. How do I do that or what's the real problem here?

P.S.

A little bit of background. I did have RailsInstaller installed but I was getting the same error so I deleted everything. I also had NodeJs installed as well but deleted that too. I erased the PATH variables completely to start from scratch.

UPDATE

Trying the RailsInstaller gives me this error:

$ gem install json -v 1.8.0
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
The system cannot find the path specified.
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

        c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile


Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.0 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
LearningRoR
  • 26,582
  • 22
  • 85
  • 150

6 Answers6

10

I hate to bump an old thread, but I wish to add to the answers just in case someone else comes by (likely as this is at the top of a Google search for a "Devkit PATH error").

After extracting the DevKit into a permanent directory and after you've navigated to the install folder within your shell and entered the "ruby dk.rb init" command, make sure you actually do the next step and install the devkit. After the init command, run "ruby dk.rb install" and that should fix many similar problems.

user3823957
  • 111
  • 1
  • 2
  • THANK YOU!!!!!! This process is not so intuitive for us windows users because we assume once it has been installed, it is done. – Ray Suelzer Aug 10 '14 at 18:14
  • ie/ "ruby c:\devkit\dk.rb init" – jonincanada Apr 11 '15 at 16:38
  • 1
    i.e., follow the official directions that another developer took the time to clearly write: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit – Hal50000 Feb 26 '16 at 21:22
  • yep, this is still how you fix the ruby devkit installation on windows 10. (kind of baffling that the official docs bury this info) – worc Apr 23 '16 at 18:19
4

You need to include the Devkit/bin directory in your environment path. First, find out where Devkit was installed. For this example, we'll presume it's at C:\Devkit.

Next open your Advanced System Settings (accessible under MyComputer => Properties), and click the Environment Variables button. Under the 'user variables' section, edit the 'Path' entry to include C:\Devkit\bin. Note that this entry is semicolon delimited so you'll need to add a trailing (or prepending) semicolon to this string.

PinnyM
  • 35,165
  • 3
  • 73
  • 81
  • Under my User Variables I put `Path` and inside of it `C:\Devkit\bin;` but still get the same error :(. I tried even to put it in my `Path` on my System variables but no luck. – LearningRoR Jun 05 '13 at 21:46
  • 1
    @LearningRoR: You need to open a new terminal console to see the effect of changing the path - it won't fix consoles that are already open. Also, have you confirmed that `C:Devkit` is where it was installed? – PinnyM Jun 05 '13 at 21:54
  • Yeah I restarted the computer and my Devkit is in c:\Devkit. I'm going to reinstall everything. – LearningRoR Jun 05 '13 at 21:59
  • Yeah, still no good. Even with a reinstall of RubyInstaller and the Devkit. – LearningRoR Jun 05 '13 at 22:06
  • I also just tried the RailsInstaller again but it throws me the same errors. – LearningRoR Jun 05 '13 at 22:18
  • @LearningRoR: Can you post the contents of the output file mentioned in the error? – PinnyM Jun 07 '13 at 03:06
  • @LearningRoR: This is the friendly console error - the actual error is in `c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.0/ext/json/ext/generator/gem_make.out`. Can you post the contents of this file (particularly the part where the error begins). – PinnyM Jun 10 '13 at 21:10
2

I was facing the excact same problem when I tried to install Cucumber until I tried using the --verbose parameter. For some reasons this worked out for me but I cannot really explain why. I am not considering it as a solution but it is worth a try.

ScottJShea
  • 7,041
  • 11
  • 44
  • 67
petruchio
  • 81
  • 4
  • I do not understand why this worked, but it did. That is possibly the last thing I would have ever tried, and yet, there it is. – Tyler MacMillan Mar 08 '14 at 17:46
  • It's really strange i tried almost everything , and --verbose flag was my last try before i could actually give up and it worked – sri85 Aug 17 '14 at 21:05
1

The best that has worked for me always in these errors is: https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-gems_fails_comspec_autorun

If you installed the devkit as per standard guidelines on https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#installation-instructions, then it's not the Devkit path but the incorrect Autorun regex key OR the incorrect command processor set by other tools that interferes with ruby gem installations. Give it a go.

Sam
  • 884
  • 6
  • 15
0

I had this issue, Windows 8 x64, Ruby 2.2.3.

I tried everything from many posts and many answers but only this worked for me: Deleting old devkits and installing again.

I got it working after these steps:

  1. Delete every folder you have ever installed devkit

  2. Install (x64 - 64bits only) DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe from http://rubyinstaller.org/downloads/

  3. Execute and install somewhere without spaces or anything on the path (I did c:\devkit)

  4. Go to your system environments and add to the path c:\devkit and c:\devkit\bin

  5. Open a CMD prompt as an admin, go to c:\devkit and type:

    ruby dk.rb init ruby dk.rb install --force

VLS
  • 2,306
  • 4
  • 22
  • 17
Helio Borges
  • 122
  • 1
  • 8
0

https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#error-failed-to-build-gem-native-extension

That details a couple scenarios that can cause this problem. Just in case the link dies, though. The first is where your COMSPEC system variable no longer has a full path to cmd.exe. The second is where some kind of autorun is in the registry--this is where you check:

REG QUERY "HKCU\Software\Microsoft\Command Processor" /s
REG QUERY "HKLM\Software\Microsoft\Command Processor" /s
REG QUERY "HKCU\Software\Wow6432Node\Microsoft\Command Processor" /s
REG QUERY "HKLM\Software\Wow6432Node\Microsoft\Command Processor" /s

And if you see any autoruns you delete them with something like:

REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun
elc
  • 1,962
  • 20
  • 24