Exception creating new Rails app (application.rb:12:in `expand_path': non-absolute home (ArgumentError))

I'm fairly new to RoR, so forgive any ignorant questions.

Setup
- Win 7 on a corp network env.
- 'HOME' drive appears to be mapped to network drive (checked with help desk...corp policy will not allow it to change to a local machine location)
- Have tried both RubyMine 4.0.3 and the 4.5 EAP release

new_project.JPG
rails_app_settings.JPG
Exception

C:\apps\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\apps\Ruby193\bin/rails _3.2.6_ new "C:/apps/JetBrains/RubyMine 4.0.3/workspaces/NewApp" --javascript=jquery --skip --database=postgresql
C:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/application.rb:12:in `expand_path': non-absolute home (ArgumentError)
 from C:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/application.rb:12:in `<top (required)>'
 from C:/apps/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
 from C:/apps/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
 from C:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/cli.rb:15:in `<top (required)>'
 from C:/apps/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
 from C:/apps/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
 from C:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/bin/rails:7:in `<top (required)>'
 from C:/apps/Ruby193/bin/rails:23:in `load'
 from C:/apps/Ruby193/bin/rails:23:in `<top (required)>'
 from -e:1:in `load'
 from -e:1:in `<main>'



Question is, are there any way around this problem?

I've tried it from a DOS command prompt as well:

C:\apps\JetBrains>rails new my_app
C:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/application.rb:12:in `expand_path': non-absolute home (ArgumentError)
        from C:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/application.rb:12:in `<top (required)>'
        from C:/apps/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
        from C:/apps/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
        from C:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/cli.rb:15:in `<top (required)>'
        from C:/apps/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
        from C:/apps/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
        from C:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/bin/rails:7:in `<top (required)>'
        from C:/apps/Ruby193/bin/rails:23:in `load'
        from C:/apps/Ruby193/bin/rails:23:in `<main>'

3 comments
Comment actions Permalink

Hi,

most likely ruby is unable to expand '~' to real path to your home directory (try File.expand_path("~") in irb to confirm this).
And it looks like as a ruby bug (Ruby doesn't work well on Windows :(
The only workaround I can think of is to set HOME directory to something else (at least in the CMD when you will try to create app), but I'm not sure
that this is the only way where ruby will try to do this.  So, if you do not want to fix the bug in Ruby I'd suggest to run Linux in VM (VirtualBox and others will help ;)

Hope this help, Oleg.

0
Comment actions Permalink

Thanks for the reply Oleg.

I tried to run irb and get the following (basically appears to be the same error to me):

C:\apps\RailsInstaller\Ruby1.9.3\bin>irb
C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rbreadline.rb:2111:in `expand_path': non-absolute home (ArgumentError)
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rbreadline.rb:2111:in `_rl_read_init_file'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rbreadline.rb:2094:in `rl_read_init_file'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rbreadline.rb:2515:in `readline_initialize_everything'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rbreadline.rb:3746:in `rl_initialize'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rbreadline.rb:4758:in `readline'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/readline.rb:40:in `readline'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/input-method.rb:115:in `gets'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb.rb:139:in `block (2 levels) in eval_input'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb.rb:138:in `block in eval_input'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:188:in `call'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:188:in `buf_input'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:103:in `getc'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/slex.rb:205:in `match_io'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/slex.rb:75:in `match'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:286:in `token'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:262:in `lex'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:233:in `block (2 levels) in each_top_level_statement'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb.rb:70:in `block in start'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb.rb:69:in `catch'
        from C:/apps/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/irb.rb:69:in `start'
        from C:/apps/RailsInstaller/Ruby1.9.3/bin/irb:12:in `<main>'



Oddly enough, I was able to use the RailsInstaller (http://railsinstaller.org/) and get a site created and running using the command line and then opened in RubyMine 4.5.
I was fiddling with VirtualBox running Ubuntu earlier, but was hoping I could get it to just run on Windows w/o the overhead of a VM.

Too bad the Ruby community is alienating Windows users by not making it work a little more flexibility.  Seems like a large missed market.

-Dave
0
Comment actions Permalink

I feel your pain (I'm using Windows ;))
But I have to say that ruby does work fine in "regular" Windows environment (English symbols in derectories names, no mounted home, etc.)
And (as some one said) this is the Open Source, so you are welcome to contribute to improve experience of ruby-developers on Windows ;)
At least file a bug about your problem to Ruby's bugtracker (http://bugs.ruby-lang.org/)

Regards, Oleg.

0

Please sign in to leave a comment.