2015-06-15 64 views
0

我有問題將我的Rails應用程序推向Heroku。當我嘗試在diabetes-app.herokuapp.com上登錄時,瀏覽器告訴我出現了一些問題,如果我在控制檯上做了heroku日誌,它會給我一個完整的跟蹤信息,但我不明白什麼是錯的。最後它說'Slug編譯失敗:無法編譯Ruby應用程序'。我認爲它應該與Rails資產管道有關,因爲如果我做git push heroku master一切都很順利,直到它開始爲Rails資產管道準備應用程序。從遠程的線上觀察:----->爲Rails資產管道準備應用程序我知道,僅僅通過這些信息解決問題並不容易,但有點暗示問題的根源在哪裏會很大。部署鐵軌mongo應用程序到heroku

這是做混帳推Heroku的主

remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Ruby app detected 
remote: -----> Compiling Ruby/Rails 
remote: -----> Using Ruby version: ruby-2.1.3 
remote: -----> Installing dependencies using 1.9.7 
remote:  Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment 
remote:  Fetching gem metadata from https://rubygems.org/........... 
remote:  Fetching version metadata from https://rubygems.org/... 
remote:  Fetching dependency metadata from https://rubygems.org/.. 
remote:  Using i18n 0.6.11 
remote:  Using json 1.8.1 
remote:  Using rake 10.4.2 
remote:  Using minitest 5.5.0 
remote:  Using thread_safe 0.3.4 
remote:  Using builder 3.2.2 
remote:  Using erubis 2.7.0 
remote:  Using rack 1.5.2 
remote:  Using mime-types 2.4.3 
remote:  Using arel 5.0.1.20140414130214 
remote:  Using bcrypt 3.1.9 
remote:  Using coffee-script-source 1.8.0 
remote:  Using execjs 2.2.2 
remote:  Using thor 0.19.1 
remote:  Using orm_adapter 0.5.0 
remote:  Using multi_json 1.10.1 
remote:  Using request_store 1.1.0 
remote:  Using hike 1.2.3 
remote:  Installing optionable 0.2.0 
remote:  Installing connection_pool 2.1.2 
remote:  Using bundler 1.9.7 
remote:  Using tilt 1.4.1 
remote:  Using rails_serve_static_assets 0.0.2 
remote:  Using rails_stdout_logging 0.0.3 
remote:  Using sass 3.2.19 
remote:  Using tzinfo 1.2.2 
remote:  Using rack-test 0.6.2 
remote:  Using warden 1.2.3 
remote:  Using mail 2.6.3 
remote:  Using coffee-script 2.3.0 
remote:  Using uglifier 2.6.0 
remote:  Using sprockets 2.12.3 
remote:  Using rails_12factor 0.0.3 
remote:  Using activesupport 4.1.7 
remote:  Using actionview 4.1.7 
remote:  Using activemodel 4.1.7 
remote:  Using jbuilder 2.2.6 
remote:  Using actionpack 4.1.7 
remote:  Using activerecord 4.1.7 
remote:  Using actionmailer 4.1.7 
remote:  Using railties 4.1.7 
remote:  Using gon 5.2.3 
remote:  Using sprockets-rails 2.2.2 
remote:  Using coffee-rails 4.1.0 
remote:  Installing origin 2.1.1 
remote:  Using responders 1.1.2 
remote:  Using jquery-rails 3.1.2 
remote:  Using rails 4.1.7 
remote:  Using sass-rails 4.0.5 
remote:  Using turbolinks 2.5.3 
remote:  Using devise 3.4.1 
remote:  Installing d3-rails 3.5.5 
remote:  Installing bson 2.3.0 
remote:  Installing moped 2.0.4 
remote:  Installing mongoid 4.0.2 
remote:  Bundle complete! 22 Gemfile dependencies, 55 gems now installed. 
remote:  Gems in the groups development and test were not installed. 
remote:  Bundled gems are installed into ./vendor/bundle. 
remote:  Bundle completed (10.20s) 
remote:  Cleaning up the bundler cache. 
remote:  Removing sdoc (0.4.1) 
remote:  Removing bundler (1.6.3) 
remote:  Removing rdoc (4.2.0) 
remote:  Removing pg (0.17.1) 
remote:  Removing friendly_id (5.0.4) 
remote: -----> Preparing app for Rails asset pipeline 
remote:  Running: rake assets:precompile 
remote:  rake aborted! 
remote:  NoMethodError: undefined method `active_record' for #<Rails::Application::Configuration:0x007f0caba339f0> 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/railtie/configuration.rb:95:in `method_missing' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/config/environments/production.rb:77:in `block in <top (required)>' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `instance_eval' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `configure' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/config/environments/production.rb:1:in `<top (required)>' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:594:in `block (2 levels) in <class:Engine>' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `each' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `block in <class:Engine>' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `instance_exec' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `run' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:55:in `block in run_initializers' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `each' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `tsort_each_child' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/initializable.rb:54:in `run_initializers' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:300:in `initialize!' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/config/environment.rb:5:in `<top (required)>' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:276:in `require_environment!' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/application.rb:389:in `block in run_tasks_blocks' 
remote:  /tmp/build_b2a9a111219cc7b78d5d89b4f5ea382e/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define' 
remote:  Tasks: TOP => environment 
remote:  (See full trace by running task with --trace) 
remote: ! 
remote: !  Precompiling assets failed. 
remote: ! 
remote: 
remote: !  Push rejected, failed to compile Ruby app 
remote: 
remote: Verifying deploy.... 
remote: 
remote: ! Push rejected to diabetes-app. 
remote: 
To [email protected]:diabetes-app.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:diabetes-app.git' 

的痕跡,我覺得這是顯示的第一個錯誤,當我做的Heroku記錄

ActionController::RoutingError (No route matches [GET] "/javascripts/devise/sessions.js"): 

這充分的最後一條消息跟蹤

2015-06-15T13:46:53.863672+00:00 heroku[slug-compiler]: Slug compilation started 
2015-06-15T13:46:53.863680+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app 

編輯

這是我的application.rb中

require File.expand_path('../boot', __FILE__) 
require "action_controller/railtie" 
require "action_mailer/railtie" 
require "rails/test_unit/railtie" 
require "sprockets/railtie" 


Bundler.require(*Rails.groups) 

module DiabetesApp 
    class Application < Rails::Application 

    config.assets.initialize_on_precompile=false 

    rake assets:precompile 
    end 
end 

這是我的配置/環境/ production.rb

Rails.application.configure do 
    config.cache_classes = true 
    config.eager_load = true 
    config.consider_all_requests_local  = false 
    config.action_controller.perform_caching = true 
    config.serve_static_assets = false 
    config.assets.js_compressor = :uglifier 
    config.assets.compile = false 
    config.log_level = :info 
    config.i18n.fallbacks = true 
    config.active_support.deprecation = :notify 
    config.log_formatter = ::Logger::Formatter.new 

end 

這是我的Gemfile

source 'https://rubygems.org' 

gem 'rails', '4.1.7' 
gem 'gon' 
gem 'sass-rails', '~> 4.0.3' 
gem 'uglifier', '>= 1.3.0' 
gem 'jquery-rails' 
gem "d3-rails" 
gem 'turbolinks' 
gem 'jbuilder', '~> 2.0' 
gem "mongoid", '~> 4.0.0' 
gem 'devise' 

group :development, :test do 
    gem 'rspec-rails', '~> 3.0' 
    gem 'cucumber-rails', :require => false 
    gem 'factory_girl_rails' 
    gem 'database_cleaner' 
    gem 'pry' 
    gem 'validates_timeliness', '~> 3.0' 
    gem 'timecop', '0.7.1' 
    gem 'awesome_print' 
    gem 'guard-rails' 
end 

group :test do 
    gem 'shoulda-matchers', require: false 
    gem "capybara-webkit" 
end 

group :production do 
    gem 'rails_12factor' 
    gem 'thin' 
end 
+0

你是否捆綁了exec bin/rake assets:precompile' –

+0

我剛剛完成了,但控制檯告訴我bundler:不可執行:bin/rake –

回答

0

正如documentation in the configuration part提到

Open myapp/config/application.rb and near the top

remove the line require "rails/all" and add the following lines so you end up with this

require "action_controller/railtie" 
require "action_mailer/railtie" 
require "active_resource/railtie" # Comment this line for Rails 4.0+ 
require "rails/test_unit/railtie" 
# require "sprockets/railtie" # Uncomment this line for Rails 3.1+ 
+0

我用application.rb編輯了我的問題我已經得到了那些需要但我不知道你的意思是「rails/all」 –

+0

它是否正確部署到heroku?或者它仍然沒有部署? –

+0

它仍然失敗在同一點=>遠程:NoMethodError:未定義的方法'active_record'爲# 遠程:/tmp/build_4e1995f990959f5d2a121ddabf423ddd/vendor/bundle/ruby/2.1.0/ gems/railties-4.1.7/lib/rails/railtie/configuration.rb:95:在'method_missing' –