Cannot install Rails with Gems on WIndows

I am using Windows Server 2007 SP2 When I try to install Rails using Gems, it gives me the following error in the DOS console:

Try running the command prompt as administrator

Hi Sharagoz,

Please see the second part of my message above. That's exactly what I did, but there's still an error.

Sharagoz -- wrote:

Do you mean that you're running it under an administrator account, or are you right-clicking on the cmd icon and chosing "run as administrator"? You need to do the latter, being an administrator is not enough.

I am both administrator on the system and doing "Run as administrator" to launch the DOS console.

Sharagoz -- wrote:

I definatly should have read your opening post more carefully. I see that there's a difference between the error message in normal and elevated mode now, which is weird.

I would start by uninstalling Ruby and then reinstalling it into a directory without a space in the filename (like C:\ruby), then try to install rails using the same account as I installed ruby with, from an elevated command prompt.

If that makes no difference, see if you have the same problem with Ruby v1.8.6

1.8.7 for windoze is available here:

http://rubyinstaller.org/download.html

Sharagoz -- wrote:

I definatly should have read your opening post more carefully. I see that there's a difference between the error message in normal and elevated mode now, which is weird.

I would start by uninstalling Ruby and then reinstalling it into a directory without a space in the filename (like C:\ruby), then try to install rails using the same account as I installed ruby with, from an elevated command prompt.

If that makes no difference, see if you have the same problem with Ruby v1.8.6

I did that already, to reinstall Ruby directly on the C:\, and tried again: gave me the same errors.

I will try to install v1.8.6 or v1.8.7, as now I have 1.9.1p243.

Greg Donald wrote:

Sharagoz -- wrote:

I definatly should have read your opening post more carefully. I see that there's a difference between the error message in normal and elevated mode now, which is weird.

I would start by uninstalling Ruby and then reinstalling it into a directory without a space in the filename (like C:\ruby), then try to install rails using the same account as I installed ruby with, from an elevated command prompt.

If that makes no difference, see if you have the same problem with Ruby v1.8.6

I tried with 1.8.7 (see image) and 1.8.6, and I get the same error.

Attachments: http://www.ruby-forum.com/attachment/4498/ErrorWith1.8.7.jpg

The only thing I can think of is that something might be up with an environment variable somewhere. If you run "set >> c:\dump.txt" from the command line it will export the variables into that file. Post the result here if you want us to have a look.

Sébastien Clément wrote:

I am using Windows Server 2007 SP2

Then, starting the DOS console as an administrator and retyping the command gives the following result:

--------------------- C:\>gem install rails ERROR: While executing gem ... (Errno::ENOENT)     No such file or directory - P:/ ---------------------

So what's that P: drive supposed to be?

Sharagoz -- wrote:

The only thing I can think of is that something might be up with an environment variable somewhere. If you run "set >> c:\dump.txt" from the command line it will export the variables into that file. Post the result here if you want us to have a look.

Here is the result for set >> c:\dump.txt

Aldric Giacomoni wrote:

Sébastien Clément wrote:

I am using Windows Server 2007 SP2

Then, starting the DOS console as an administrator and retyping the command gives the following result:

--------------------- C:\>gem install rails ERROR: While executing gem ... (Errno::ENOENT)     No such file or directory - P:/ ---------------------

So what's that P: drive supposed to be?

P: is a network drive, but it was nowhere specified at initial installation of Ruby or when I tried to run Gem, so I don't know where it gets it.

HOMEDRIVE=P:

Your problem is probably there. Run "set HOMEDRIVE=C:" To verify that it has been set correctly run "echo %HOMEDRIVE%", which should now print out "C:". Try to install rails.

If that enables you to install gems you may want to edit the value permanently to avoid future problems. The homedrive key is located here: HKEY_CURRENT_USER\Volatile Environment

Sharagoz -- wrote:

HOMEDRIVE=P:

Your problem is probably there. Run "set HOMEDRIVE=C:" To verify that it has been set correctly run "echo %HOMEDRIVE%", which should now print out "C:". Try to install rails.

If that enables you to install gems you may want to edit the value permanently to avoid future problems. The homedrive key is located here: HKEY_CURRENT_USER\Volatile Environment

IT WORKS! See below.

Many thanks Sharagoz.

for followers, upgrading to a newer version of rubygems (which required 1.8.7) fixed it for me.