简体   繁体   中英

jruby no such file to load application.rb

I have a project in jRuby that I try to run. So I'm installling jruby using rvm like this

rvm install jruby-9.1.15.0 (bc thats the version required by the project)

then im making sure that im actually using jruby by typing ruby -v which shows me that I have jruby

next thing, I want to run the rails server so I'm typing

bundle exec rails server

and unfortunately I get an error:

/Users/foouser/Documents/Projects/fooproject/bin/config/application
LoadError: no such file to load -- /Users/foouser/Documents/Projects/fooproject/bin/config/application
          require at org/jruby/RubyKernel.java:955
  block in server at /Users/foouser/.rvm/gems/jruby-9.1.15.0-jrubu/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:78
              tap at org/jruby/RubyKernel.java:1741
           server at /Users/foouser/.rvm/gems/jruby-9.1.15.0-jrubu/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:75
     run_command! at /Users/foouser/.rvm/gems/jruby-9.1.15.0-jrubu/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39
           <main> at /Users/foouser/.rvm/gems/jruby-9.1.15.0-jrubu/gems/railties-4.2.10/lib/rails/commands.rb:17
          require at org/jruby/RubyKernel.java:955
           <main> at bin/rails:5

I've tried googling that but to no avail. People seem to not encounter this issue at all. I'm sure it's got something to do with my setup because other people are successfully using said project.

Any ideas?

rails version - 4.2 jruby version - 9.1.15.0

EDIT:

after some digging, in bin/rails file the line defining the APP_PATH was like that:

APP_PATH = File.expand_path('../config/application', __FILE__)

which somehow made it looking for application.rb inside fooproject/bin/config instead of fooproject/config

but when I changed the line to

APP_PATH = File.expand_path('../../config/application', __FILE__)

it goes to the correct path where application.rb exist but still reports it as not existing.

the error is nearly the same (apart for path)

LoadError: no such file to load -- /Users/foouser/Documents/Projects/fooproject/config/application
          require at org/jruby/RubyKernel.java:955
  block in server at /Users/foouser/.rvm/gems/jruby-9.1.15.0-jrubu/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:78
              tap at org/jruby/RubyKernel.java:1741
           server at /Users/foouser/.rvm/gems/jruby-9.1.15.0-jrubu/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:75
     run_command! at /Users/foouser/.rvm/gems/jruby-9.1.15.0-jrubu/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39
           <main> at /Users/foouser/.rvm/gems/jruby-9.1.15.0-jrubu/gems/railties-4.2.10/lib/rails/commands.rb:17
          require at org/jruby/RubyKernel.java:955
           <main> at bin/rails:4

EDIT 2:

requested permissions for application.rb:

-rw-r--r-- 1 foouser staff 5818 20 Jun 15:12 config/application.rb

config.ru:

# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment',  __FILE__)
run Rails.application

environment.rb

# Load the Rails application.
require File.expand_path('../application', __FILE__)

# Initialize the Rails application.
Rails.application.initialize!

So, the solution I have is the "have you tried to turn it off and on again?" type. I have deleted the whole project and cloned it again from the repo. Everything is working now, it must have been something with my local env but I can't tell what.

Anyway, if you ever encounter something similar - purge and clone is definitely something you can try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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