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:


C:>gem install rails
ERROR: While executing gem … (Errno::EACCES)
Permission denied - C:/Program Files/Ruby19/bin/rake.bat

C:>

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:/

Can anyone help on this ?

Sébastien

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:

Try running the command prompt as administrator

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 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 am both administrator on the system
and doing “Run as administrator” to launch the DOS console.

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.

On Thu, Feb 18, 2010 at 2:25 PM, Sharagoz – [email protected]
wrote:

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


Greg D.
destiney.com | gregdonald.com

Greg D. wrote:

On Thu, Feb 18, 2010 at 2:25 PM, Sharagoz – [email protected]
wrote:

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


Greg D.
destiney.com | gregdonald.com

Is there a difference between the versions on that page and those on
RubyForge ?
http://rubyforge.org/frs/?group_id=167

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.

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.

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.

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

ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\seclemen\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=S-QUE-CWFCDBS
ComSpec=C:\Windows\system32\cmd.exe
DEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
FP_NO_HOST_CHECK=NO
HOMEDRIVE=P:
HOMEPATH=
HOMESHARE=\s2-que-nas\perso$\seclemen
LOCALAPPDATA=C:\Users\seclemen\AppData\Local
LOGONSERVER=\S2-QUE-R2
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program
Files\PostgresPlus\8.4SS\bin;C:\Ruby\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 8, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0f08
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
PROMPT=$P$G
PUBLIC=C:\Users\Public
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\seclemen\AppData\Local\Temp
TMP=C:\Users\seclemen\AppData\Local\Temp
USERDNSDOMAIN=NRN.NRCAN.GC.CA
USERDOMAIN=NRN
USERNAME=seclemen
USERPROFILE=C:\Users\seclemen
VSEDEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
windir=C:\Windows

Aldric G. 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

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:

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.

=======================================
C:\Windows\system32>set HOMEDRIVE=C:
C:\Windows\system32>set homedrive
HOMEDRIVE=C:

C:\Windows\system32>gem install rails
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed
Installing ri documentation for rake-0.8.7…
Installing ri documentation for activesupport-2.3.5…
Installing ri documentation for activerecord-2.3.5…
Installing ri documentation for rack-1.0.1…
Installing ri documentation for actionpack-2.3.5…
Installing ri documentation for actionmailer-2.3.5…
Installing ri documentation for activeresource-2.3.5…
Installing ri documentation for rails-2.3.5…
Installing RDoc documentation for rake-0.8.7…
Installing RDoc documentation for activesupport-2.3.5…
Installing RDoc documentation for activerecord-2.3.5…
Installing RDoc documentation for rack-1.0.1…
Installing RDoc documentation for actionpack-2.3.5…
Installing RDoc documentation for actionmailer-2.3.5…
Installing RDoc documentation for activeresource-2.3.5…
Installing RDoc documentation for rails-2.3.5…

C:\Windows\system32>

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