JRuby error: No such file or directory -- rails (LoadError) #559

Closed
vbernabe opened this Issue Mar 5, 2013 · 4 comments

Comments

Projects
None yet
2 participants

vbernabe commented Mar 5, 2013

I tried to install jruby on my windows machine but keeps on getting an error when I run the command jruby -S rails -v. I've searched around and tried to install different versions of JRuby but still getting the same error.

jruby -S rails -v
jruby: No such file or directory -- rails (LoadError)

Here are some info on my setup:
Windows Xp

jruby -v
jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on Java HotSpot(TM) Client VM 1.6.0_3-b05 [Windows XP-x86]

set GEM_PATH=C:/jruby-1.7.3/lib/ruby
set GEM_HOME=C:/jruby-1.7.3/lib/ruby

jruby -S gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.24
  • RUBY VERSION: 1.9.3 (2013-02-21 patchlevel 385) [java]
  • INSTALLATION DIRECTORY: C:/jruby-1.7.3/lib/ruby
  • RUBY EXECUTABLE: C:/jruby-1.7.3/bin/jruby.exe
  • EXECUTABLE DIRECTORY: C:/jruby-1.7.3/lib/ruby/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • universal-java-1.6
  • GEM PATHS:
    • C:/jruby-1.7.3/lib/ruby
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
    • "install" => "--no-rdoc --no-ri --env-shebang"
    • "update" => "--no-rdoc --no-ri --env-shebang"
  • REMOTE SOURCES:

jruby -S gem install rails --pre --no-rdoc --no-ri
..
..
32 gems installed

jruby -S gem list --local
*** LOCAL GEMS ***
actionmailer (4.0.0.beta1)
actionpack (4.0.0.beta1)
activemodel (4.0.0.beta1)
activerecord (4.0.0.beta1)
activerecord-deprecated_finders (0.0.3)
activesupport (4.0.0.beta1)
arel (4.0.0.beta1)
atomic (1.0.1 java)
builder (3.1.4)
bundler (1.3.1)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.4)
json (1.7.7 java)
mail (2.5.3)
mime-types (1.21)
minitest (4.6.2)
multi_json (1.6.1)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
rails (4.0.0.beta1)--------------> rails
railties (4.0.0.beta1)
rake (10.0.3)
rdoc (3.12.2)
sprockets (2.9.0)
sprockets-rails (2.0.0.rc3)
thor (0.17.0)
thread_safe (0.1.0)
tilt (1.3.4)
treetop (1.4.12)
tzinfo (0.3.36)

Owner

BanzaiMan commented Mar 6, 2013

Is JRuby loading rails from where you think?

jruby -S gem which rails

Also, see what jruby -Xdebug.scriptResolution=true -S rails says and examine which rails script jruby is loading. If C:/jruby-1.7.3/lib/ruby/bin/rails exists, then try executing it directly:

jruby C:/jruby-1.7.3/lib/ruby/bin/rails

vbernabe commented Mar 6, 2013

hi banzaiman,

thanks for the reply..here's what I get..

jruby -S gem which rails
C:/jruby-1.7.3/lib/ruby/gems/railties-4.0.0.beta1/lib/rails.rb

jruby -Xdebug.scriptResolution=true -S rails
jruby: No such file or directory -- rails (LoadError)

I guess jruby can't reference my installed gems on GEM_PATH when I just do jruby -S rails.

JRuby should be able resolve to the installed gems since I have GEM_PATH env variable?

If I try to directly execute with the following command (without -S - rails.rb) though I get nothing..

jruby "C:/jruby-1.7.3/lib/ruby/gems/railties-4.0.0.beta1/lib/rails.rb" -v

and with only rails command

jruby "C:/jruby-1.7.3/lib/ruby/gems/railties-4.0.0.beta/lib/rails" -v
Error opening script file: C:/jruby-1.7.3/lib/ruby/gems/railties-4.0.0.beta1/lib/rails (Access is denied)

Owner

BanzaiMan commented Mar 6, 2013

So, jruby is not finding a script named rails in any of the standard location. It is not clear to me why.

When you invoke rails directly, you should look for bin/rails, not …/lib/rails, which is most likely a directory and therefore cannot be executed.

Owner

BanzaiMan commented Apr 2, 2013

I'm closing this, but if you have evidence to suggest that there is a JRuby issue to fix, do let us know.

@BanzaiMan BanzaiMan closed this Apr 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment