2014-02-12 61 views
3

我試圖安裝Doorkeeper在新鮮的rails(4.0.2)安裝。之後,我的寶石添加到Gemfile中並安裝它,我嘗試運行安裝門衛:未初始化的常量錯誤

rails generate doorkeeper:install 

,並出現以下錯誤:

/Users/mam8cc/Projects/doorkeeper/config/application.rb:10:in `<module:Doorkeeper>': uninitialized constant Doorkeeper::Rails::Application (NameError) 
    from /Users/mam8cc/Projects/doorkeeper/config/application.rb:9:in `<top (required)>' 
    from /Users/mam8cc/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands.rb:43:in `require' 
    from /Users/mam8cc/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands.rb:43:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

我applications.rb

require File.expand_path('../boot', __FILE__) 

require 'rails/all' 

# Require the gems listed in Gemfile, including any gems 
# you've limited to :test, :development, or :production. 
Bundler.require(:default, Rails.env) 

module Doorkeeper 
    class Application < Rails::Application 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # -- all .rb files in that directory are automatically loaded. 

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 
    # config.time_zone = 'Central Time (US & Canada)' 

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 
    # config.i18n.default_locale = :de 
    end 
end 

而我的Gemfile爲後人

source 'https://rubygems.org' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.0.2' 

# Use sqlite3 as the database for Active Record 
gem 'sqlite3' 

# Use SCSS for stylesheets 
gem 'sass-rails', '~> 4.0.0' 

# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 

# Use CoffeeScript for .js.coffee assets and views 
gem 'coffee-rails', '~> 4.0.0' 

# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 
gem 'doorkeeper' 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 1.2' 

group :doc do 
    # bundle exec rake doc:rails generates the API under doc/api. 
    gem 'sdoc', require: false 
end 

# Use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.1.2' 

# Use unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano', group: :development 

# Use debugger 
# gem 'debugger', group: [:development, :test] 

回答

6

問題在於您的項目與您嘗試安裝的軟件包具有相同的名稱。改變項目的名稱,它應該工作。