简体   繁体   English

在Windows 7 64位上运行gem install时出错

[英]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. 我刚刚使用rubyinstaller.org的安装程序安装了ruby 1.9.2-p136,现在我正在尝试安装rails。 When I do "gem install rails" I get the following error: 当我做“gem install rails”时,我收到以下错误:

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: 以下是我正在运行的ruby和gem版本:

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? 更新 :在这里找到解决方案: 如何阻止'gem'实用程序访问我的主目录?

Added the following to the start of my bin/gem: 在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 在我的情况下,从命令提示符运行以下命令将homedrive修复为c:并修复了gem更新问题
SET HOMEDRIVE=c: SET HOMEDRIVE = c:

your HOMEDRIVE was set to P:, after that command it will be set to C: 你的HOMEDRIVE设置为P:,在该命令之后它将被设置为C:
you can test by writing only 你可以只写书来测试
SET HOMEDRIVE SET HOMEDRIVE
before and after setting it to C: 在将其设置为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). 您可能不想更改您的HOMEDRIVE(公司笔记本电脑通常设置为HOMERIVE到网络驱动器,在您执行gem安装时可能会断开连接)。 I think is not advisable either change the HOMEDRIVE or 我认为不建议改变HOMEDRIVE或

stop the 'gem' utility from accessing my home directory 阻止'gem'实用程序访问我的主目录

The correct solution to this question is to specify the HOME environment variable which is actually missing in your system. 此问题的正确解决方案是指定系统中实际缺少的HOME环境变量。 Rubygem always search for it before using the HOMEDRIVE. Rubygem在使用HOMEDRIVE之前总是搜索它。 The simplest solution is then specify the new env variable: 最简单的解决方案是指定新的env变量:

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. 我遇到了这个问题 - 同样的错误,但它在\\ Ruby \\ bin中的setrvbars.bat文件中引用了窒息。 My fix is on tumblr , but briefly: 我的修复是关于tumblr的 ,但是简单地说:

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. 出于某种原因, HOMEDRIVE未设置为正确的驱动器。 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) 要解决此问题,请从run菜单启动regedit转到HKEY_CURRENT_USER\\Volatile Environment并将HOMEDRIVE更改为驱动器(C:在我的情况下)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM