gem install rails (Errno::ENOENT) No such file or directory

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

Jesús,

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

Anthony Crumley

http://commonthread.com

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.

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).

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

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

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).

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

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

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.

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

Jesús Dugarte.-