Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error running gem install on Windows 7 64 bit

I just installed ruby 1.9.2-p136 using the installer from rubyinstaller.org and now I am trying to install rails. When I do "gem install rails" I get the following error:

C:\Users\Clayton.USA>gem install rails
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - P:/

Here are the ruby and gem versions I'm running:

C:\Users\Clayton.USA>ruby -v
ruby 1.9.2p136 (2010-12-25) [i386-mingw32]

C:\Users\Clayton.USA>gem -v
1.3.7

Update: found the solution here: How to stop the 'gem' utility from accessing my home directory?

Added the following to the start of my bin/gem:

ENV['HOME'] = "D:/Ruby192"
like image 485
Clayton Avatar asked Feb 13 '11 22:02

Clayton


2 Answers

In my case running following command from command prompt fixed the homedrive to c: and fixed the gem update issue
SET HOMEDRIVE=c:

your HOMEDRIVE was set to P:, after that command it will be set to C:
you can test by writing only
SET HOMEDRIVE
before and after setting it to C:

like image 189
Orhan Celik Avatar answered Sep 22 '22 17:09

Orhan Celik


You may not want to change your HOMEDRIVE (company laptops are often set with HOMERIVE to a network drive, which may be disconnected at the moment you execute the gem install). I think is not advisable either change the HOMEDRIVE or

stop the 'gem' utility from accessing my home directory

The correct solution to this question is to specify the HOME environment variable which is actually missing in your system. Rubygem always search for it before using the HOMEDRIVE. The simplest solution is then specify the new env variable:

SET HOME %USERPROFILE%

like image 31
Emiliano Poggi Avatar answered Sep 23 '22 17:09

Emiliano Poggi