我在jRuby中有一个尝试运行的项目。 所以我要像这样用rvm安装jruby
rvm install jruby-9.1.15.0
(bc就是项目所需的版本)
然后通过输入以下内容来确保即时通讯确实使用了jruby
ruby -v
告诉我我有jruby
接下来,我想运行Rails服务器,所以我要输入
bundle exec rails server
不幸的是,我得到一个错误:
/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
我已经尝试过使用Google搜索,但无济于事。人们似乎根本没有遇到这个问题。我确定这与我的设置有关,因为其他人正在成功使用上述项目。
有什么想法吗?
导轨版本-4.2 jruby版本-9.1.15.0
编辑:
经过一些挖掘,在bin/rails
文件中定义APP_PATH
的行是这样的:
APP_PATH = File.expand_path('../config/application', __FILE__)
以某种方式使其在fooproject/bin/config
而不是fooproject/config
内寻找application.rb
但是当我将行更改为
APP_PATH = File.expand_path('../../config/application', __FILE__)
它将转到存在application.rb的正确路径,但仍将其报告为不存在。
错误几乎相同(路径除外)
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
编辑2:
请求的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!
答案 0 :(得分:0)
因此,我的解决方案是“您是否尝试过将其关闭然后再次打开?”类型。 我已经删除了整个项目,并再次从仓库中克隆了它。 现在一切正常,我的本地环境一定有问题,但是我不知道是什么。
无论如何,如果您遇到类似的问题-清除和克隆绝对是您可以尝试的事情。