2015-06-15 28 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' –