开发者

Error running gem install on Windows 7 64 bit

开发者 https://www.devze.com 2023-02-10 11:04 出处:网络
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:

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开发者_JS百科.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"


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:


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%


I ran into this issue with a twist - same error but it was choking on quotes in the setrvbars.bat file in \Ruby\bin. My fix is on tumblr, but briefly:

This line read:

SET GEM_HOME=”C:\Ruby193\lib\ruby\gems\1.9.1”

Gem update was choking on the quotes. I dropped the quotes:

SET GEM_HOME=C:\Ruby193\lib\ruby\gems\1.9.1

And now it works fine.


For some reason, the HOMEDRIVE is not set to the correct drive. To fix it, launch regedit from the run menu Go to HKEY_CURRENT_USER\Volatile Environment and change the HOMEDRIVE to your drive (C: in my case)

0

精彩评论

暂无评论...
验证码 换一张
取 消