Rails:已初始化常量APP_PATH

时间:2016-01-31 11:43:54

标签: ruby-on-rails ruby

$ rails server
bin/rails:6: warning: already initialized constant APP_PATH
/Users/songhowon/job/onboardiq_app/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

我尝试了一切。我重新安装了rbenvruby等。根据以下帖子,许多人都有同样的问题,但这对我不起作用。

rails server bin/rails:6: warning: already initialized constant APP_PATH error

奇怪的是这个错误只发生在特定的应用程序中。在新创建的应用中,rails s效果很好。我很感激这个问题的任何帮助。

1 个答案:

答案 0 :(得分:0)

尝试加入bin/rails

#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
  # need to investigate this error
  # but in production it will happen, so cannot just raise everytime
  raise if defined?(Rails) and Rails.env.development?
end
APP_PATH = File.expand_path('../../config/application',  __FILE__)
require_relative '../config/boot'
require 'rails/commands'