Forum: Ruby on Rails gem install rails (Errno::ENOENT) No such file or directory

Posted by Jesús Dugarte (jdugarte)
on 2010-04-09 22:48
I have two PCs, one with Windows XP and another with Windows Vista. I'm
working as an administrator in both computers. I'm using Ruby 1.8.7 and
Rubygems 1.3.6. When I try to install Rails I get this error:

C:\>gem install rails
ERROR:  While executing gem ... (Errno::ENOENT)
No such file or directory - C:/Users/Jesús Dugarte

I have installed Rails several times before (although I haven't done it
in about a year), and I'd never had this problem before. Has anything
changed in the installation? I've found several cases similar to mine in
internet, but none of the proposed solutions works for me.

Thanks,

Jesús Dugarte.-
Posted by Anthony Crumley (Guest)
on 2010-04-10 08:30
(Received via mailing list)
Jesús,

Have you tried installing ruby into a directory path that does not have 
any
spaces in it?

Anthony Crumley
http://commonthread.com
Posted by Rahul Mehta (Guest)
on 2010-04-10 11:04
(Received via mailing list)
1)    Go to http://rubyonrails.org/download  that is official download
page for ruby on rails.

2)    First download ruby. For windows it is one click installer
package just download it and double click it and follow installation
wizard.

3)    Download ruby gems from same page, extract it and then run ruby
setup.rb, just double click it.

4)    To install rails type “gem install rails” in terminal, it will
automatically install rails for you.
Posted by Chris Morris (Guest)
on 2010-04-11 07:07
(Received via mailing list)
Try running Sysinternals Process Monitor and look for file system 
activity
around the time the error occurs. Could give more details on why ruby 
can't
see that folder. (What's the error msg on XP? That msg looks Vista
specific).

On Fri, Apr 9, 2010 at 3:48 PM, Jesús Dugarte <lists@ruby-forum.com> 
wrote:

> changed in the installation? I've found several cases similar to mine in
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscribe@googlegroups.com<rubyonrails-talk%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


--
Chris
http://improvingenterprises.com
http://clabs.org
Posted by Jesús Dugarte (jdugarte)
on 2010-04-12 20:25
Anthony Crumley wrote:
> Jesús,
> 
> Have you tried installing ruby into a directory path that does not have 
> any
> spaces in it?
> 
> Anthony Crumley
> http://commonthread.com

Ruby is actually installed in the default directory, C:\Ruby, without 
spaces o any other special character. And I don't have any problem 
installing Ruby. It's Rails that I'm having problems with.

Jesús Dugarte.-
Posted by Jesús Dugarte (jdugarte)
on 2010-04-12 20:26
Rahul Mehta wrote:
> 1)    Go to http://rubyonrails.org/download  that is official download
> page for ruby on rails.
> 
> 2)    First download ruby. For windows it is one click installer
> package just download it and double click it and follow installation
> wizard.
> 
> 3)    Download ruby gems from same page, extract it and then run ruby
> setup.rb, just double click it.
> 
> 4)    To install rails type �gem install rails� in terminal, it will
> automatically install rails for you.

Yes, that's exactly what I did, and exactly what I've done many times in 
the past, but this time it won't let me install Rails when I do "gem 
install rails"

Jesús Dugarte.-
Posted by Jesús Dugarte (jdugarte)
on 2010-04-12 21:28
Chris Morris wrote:
> Try running Sysinternals Process Monitor and look for file system 
> activity
> around the time the error occurs. Could give more details on why ruby 
> can't
> see that folder. (What's the error msg on XP? That msg looks Vista
> specific).
> 
> On Fri, Apr 9, 2010 at 3:48 PM, Jesús Dugarte <lists@ruby-forum.com> 
> wrote:
> 
>> changed in the installation? I've found several cases similar to mine in
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscribe@googlegroups.com<rubyonrails-talk%2Bunsubscribe@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
> 
> 
> --
> Chris
> http://improvingenterprises.com
> http://clabs.org

The error message in XP is exactly the same, with the exception of the 
directory ("Documents and Settings" instead of "Users").

I'm going to try with Sysinternals Process Monitor to see what I can 
find out.

Thanks,

Jesús Dugarte.-
Posted by Jesús Dugarte (jdugarte)
on 2010-04-12 22:07
Jesús Dugarte wrote:
> I have two PCs, one with Windows XP and another with Windows Vista. I'm
> working as an administrator in both computers. I'm using Ruby 1.8.7 and
> Rubygems 1.3.6. When I try to install Rails I get this error:
> 
> C:\>gem install rails
> ERROR:  While executing gem ... (Errno::ENOENT)
> No such file or directory - C:/Users/Jesús Dugarte
> 
> I have installed Rails several times before (although I haven't done it
> in about a year), and I'd never had this problem before. Has anything
> changed in the installation? I've found several cases similar to mine in
> internet, but none of the proposed solutions works for me.
> 
> Thanks,
> 
> Jesús Dugarte.-

Using this 
http://stackoverflow.com/questions/849660/how-to-stop-the-gem-utility-from-accessing-my-home-directory 
as a base, I manage to make it work. My gem.bat looks like this now:

@ECHO OFF
SET _HOMEPATH=%HOMEPATH%
SET HOMEPATH=\Ruby
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"ruby.exe" "C:\Ruby\bin\gem" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"ruby.exe" "%~dpn0" %*
:EOF
SET HOMEPATH=%_HOMEPATH%

Although I'm now wondering if there will be any unexpected consequence 
of having the .gem directory inside the ruby directory (C:\Ruby) and not 
where it used to be (C:\Users\Jesús Dugarte).

Thanks,

Jesús Dugarte.-
Posted by Nikolay Kotlyarov (moron)
on 2010-04-15 23:10
The error appears because of Gem#find_home(rubygems.rb line 498) method 
not working with unicode characters which can be present in your homedir 
path(and in your case they definitely are).
That method reads the followig environment variables: 'HOME', 
'USERPROFILE', ['HOMEDRIVE'+'HOMEPATH'].

This homepath is used to define @update_cache variable(spec_fetcher.rb 
line 46):
@update_cache = File.stat(Gem.user_home).uid == Process.uid
with related consequences.

I think you should reset your gem.bat to default and only use your 
version when needed.

Also you can just undefine HOMEPATH environment variable before using 
gem utility:
(windows -- Start->Run->cmd)
set HOMEPATH=
gem install <somegem>
<...>
After closing cmd-session this variable would be set to default 
automatically.
Posted by Jesús Dugarte (jdugarte)
on 2010-04-15 23:29
Nikolay Kotlyarov wrote:
> The error appears because of Gem#find_home(rubygems.rb line 498) method 
> not working with unicode characters which can be present in your homedir 
> path(and in your case they definitely are).
> That method reads the followig environment variables: 'HOME', 
> 'USERPROFILE', ['HOMEDRIVE'+'HOMEPATH'].
> 
> This homepath is used to define @update_cache variable(spec_fetcher.rb 
> line 46):
> @update_cache = File.stat(Gem.user_home).uid == Process.uid
> with related consequences.
> 
> I think you should reset your gem.bat to default and only use your 
> version when needed.
> 
> Also you can just undefine HOMEPATH environment variable before using 
> gem utility:
> (windows -- Start->Run->cmd)
> set HOMEPATH=
> gem install <somegem>
> <...>
> After closing cmd-session this variable would be set to default 
> automatically.

Thank you, Nikolay, for the detailed explanation. I created a mygem.bat 
with my version, to use it in case the regular gem.bat doesn't work. I 
hope this won't get me in any more troubles ;-)

Jesús Dugarte.-
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.