2013-07-05 36 views
0

即時嘗試將我的應用程序部署到Heroku。 我正在使用Rails 4,最新設計(試用3.0.0.rc和回購)和紅寶石1.9.3(也試過2.0)。 我無法過去的初步推動,似乎像heroku沒有看到設計。本地assets:precompile任務運行沒有問題。 這裏是輸出:Rails 4 + Devise + Heroku

git push heroku master                                  -----> Ruby/Rails app detected 
-----> Using Ruby version: ruby-1.9.3 
-----> Installing dependencies using Bundler version 1.3.2 
     Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment 
     Fetching gem metadata from https://rubygems.org/.......... 
     Fetching gem metadata from https://rubygems.org/.. 
     Installing rake (10.1.0) 
     Installing i18n (0.6.4) 
     Installing minitest (4.7.5) 
     Installing multi_json (1.7.7) 
     Installing atomic (1.1.10) 
     Installing thread_safe (0.1.0) 
     Installing tzinfo (0.3.37) 
     Installing activesupport (4.0.0) 
     Installing builder (3.1.4) 
     Installing erubis (2.7.0) 
     Installing rack (1.5.2) 
     Installing rack-test (0.6.2) 
     Installing actionpack (4.0.0) 
     Installing mime-types (1.23) 
     Installing polyglot (0.3.3) 
     Installing treetop (1.4.14) 
     Installing mail (2.5.4) 
     Installing actionmailer (4.0.0) 
     Installing activemodel (4.0.0) 
     Installing activerecord-deprecated_finders (1.0.3) 
     Installing arel (4.0.0) 
     Installing activerecord (4.0.0) 
     Installing bcrypt-ruby (3.0.1) 
     Installing coffee-script-source (1.6.3) 
     Installing execjs (1.4.0) 
     Installing coffee-script (2.2.0) 
     Installing thor (0.18.1) 
     Installing railties (4.0.0) 
     Installing coffee-rails (4.0.0) 
     Installing orm_adapter (0.4.0) 
     Installing warden (1.2.1) 
     Installing devise (3.0.0.rc) 
     Installing tilt (1.4.1) 
     Installing haml (4.0.3) 
     Installing haml-rails (0.4) 
     Installing hike (1.2.3) 
     Installing jbuilder (1.4.2) 
     Installing jquery-rails (3.0.2) 
     Installing json (1.8.0) 
     Installing mysql2 (0.3.11) 
     Installing nested_form (0.3.2) 
     Installing pg (0.15.1) 
     Using bundler (1.3.2) 
     Installing sprockets (2.10.0) 
     Installing sprockets-rails (2.0.0) 
     Installing rails (4.0.0) 
     Installing rails_serve_static_assets (0.0.1) 
     Installing rails_stdout_logging (0.0.1) 
     Installing rails_12factor (0.0.2) 
     Installing rdoc (3.12.2) 
     Installing sass (3.2.9) 
     Installing sass-rails (4.0.0) 
     Installing sdoc (0.3.20) 
     Installing simple_form (1.4.1) 
     Installing turbolinks (1.2.0) 
     Installing twitter-bootstrap-rails (2.2.7) 
     Installing uglifier (2.1.1) 
     Your bundle is complete! It was installed into ./vendor/bundle 
     Post-install message from haml: 
     HEADS UP! Haml 4.0 has many improvements, but also has changes that may break 
     your application: 
     * Support for Ruby 1.8.6 dropped 
     * Support for Rails 2 dropped 
     * Sass filter now always outputs <style> tags 
     * Data attributes are now hyphenated, not underscored 
     * html2haml utility moved to the html2haml gem 
     * Textile and Maruku filters moved to the haml-contrib gem 
     For more info see: 
     http://rubydoc.info/github/haml/haml/file/CHANGELOG.md 
     Post-install message from rdoc: 
     Depending on your version of ruby, you may need to install ruby rdoc/ri data: 
     <= 1.8.6 : unsupported 
     = 1.8.7 : gem install rdoc-data; rdoc-data --install 
     = 1.9.1 : gem install rdoc-data; rdoc-data --install 
     >= 1.9.2 : nothing to do! Yay! 
     Post-install message from twitter-bootstrap-rails: 
     Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS. 
     ********************************************** 
     ExecJS supports these runtimes: 
     therubyracer - Google V8 embedded within Ruby 
     therubyrhino - Mozilla Rhino embedded within JRuby 
     Node.js 
     Apple JavaScriptCore - Included with Mac OS X 
     Microsoft Windows Script Host (JScript) 
     ********************************************** 
     Cleaning up the bundler cache. 
-----> Writing config/database.yml to read from DATABASE_URL 
-----> Preparing app for Rails asset pipeline 
     Running: rake assets:precompile 
     rake aborted! 
     undefined method `devise' for #<Class:0x00000002962218> 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/dynamic_matchers.rb:22:in `method_missing' 
     /tmp/build_238qt4r3vnes0/app/models/user.rb:5:in `<class:User>' 
     /tmp/build_238qt4r3vnes0/app/models/user.rb:1:in `<top (required)>' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:329:in `require_or_load' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:462:in `load_missing_constant' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:183:in `const_missing' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:in `const_get' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:in `block in constantize' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `each' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `inject' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `constantize' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:534:in `get' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:565:in `constantize' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise.rb:274:in `get' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/mapping.rb:77:in `to' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/mapping.rb:72:in `modules' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/mapping.rb:89:in `routes' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/mapping.rb:156:in `default_used_route' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/mapping.rb:66:in `initialize' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise.rb:308:in `new' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise.rb:308:in `add_mapping' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/rails/routes.rb:208:in `block in devise_for' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/rails/routes.rb:207:in `each' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/rails/routes.rb:207:in `devise_for' 
     /tmp/build_238qt4r3vnes0/config/routes.rb:2:in `block in <top (required)>' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw' 
     /tmp/build_238qt4r3vnes0/config/routes.rb:1:in `<top (required)>' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:102:in `reload_routes!' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/devise-3.0.0.rc/lib/devise/rails.rb:14:in `block in <class:Engine>' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:36:in `call' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:in `each' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application/finisher.rb:55:in `block in <module:Finisher>' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing' 
     /tmp/build_238qt4r3vnes0/config/environment.rb:5:in `<top (required)>' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks' 
     /tmp/build_238qt4r3vnes0/vendor/bundle/ruby/1.9.1/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define' 
     Tasks: TOP => environment 
     (See full trace by running task with --trace) 
! 
!  Precompiling assets failed. 
! 

!  Push rejected, failed to compile Ruby/Rails app 

我的Gemfile:

ruby '1.9.3' 
source 'https://rubygems.org' 


gem 'rails', '4.0.0' 
gem 'mysql2' 
gem 'simple_form' 
gem 'twitter-bootstrap-rails' 
gem 'haml-rails' 
gem 'devise', "3.0.0rc" 
gem 'nested_form' 
gem 'rails_12factor' 


gem 'sass-rails', '~> 4.0.0' 
gem 'uglifier', '>= 1.3.0' 
gem 'coffee-rails', '~> 4.0.0' 
gem 'jquery-rails' 
gem 'turbolinks' 
gem 'jbuilder', '~> 1.2' 

group :doc do 
    gem 'sdoc', require: false 
end 

group :production do 
    gem 'pg' 
end 

group :development, :test do 
gem 'rspec-rails' 
gem 'capybara' 
gem 'factory_girl_rails' 
gem 'faker' 
gem 'guard-rspec' 
gem 'terminal-notifier-guard' 
gem 'quiet_assets' 
end 

group :development do 
    gem 'thin' 
end 

group :test do 
gem 'database_cleaner' 
gem 'fuubar' 
gem 'shoulda' 
end 
+0

看起來像問題是與資產預編譯嘗試預編譯在開發中,並推動到heroku – Viren

回答

1

試試這個

rails generate devise:install 
+1

爲什麼目的?然後,設計試圖覆蓋我的文件,之後,heroku部署仍然失敗。 –

1

heroku labs:enable user-env-compile -a myapp

這是一個資產管道的事情,而不是Rails4或設計。

+0

從來沒有聽說過這個。 可悲的是沒有幫助,結果是一樣的:( –

0

您沒有在您的Gemfile中安裝therubyracer的寶石。

1

我不認爲therubyracer寶石會有所幫助。我自己並沒有使用它,而且我沒有遇到這個特殊的問題。由於Heroku使用了大量內存,因此現在也不鼓勵使用該寶石。他們正在使用Node來編譯資產。 (https://devcenter.heroku.com/articles/rails-asset-pipeline

您是否在推送您的應用程序之前在Heroku上創建了數據庫?在此主題的討論表明,這可能會解決問題:https://github.com/plataformatec/devise/issues/1339。我與之合作的講師還讓他的學生在第一次推送他們的應用程序之前創建數據庫。如果你需要它,命令是:

heroku addons:add heroku-postgresql. 

如果不工作,另一種選擇是設置:

config.assets.initialize_on_precompile = false 

的設計文檔說,這是必要的設計使用Rails 3.1在Heroku上。我知道你使用的是Rails 4,所以這可能無濟於事 - 但如果首先創建數據庫不起作用,似乎值得嘗試。

0

都沒有這個問題,但我設置了看起來像在enivronment(C9)這個 的Gemfile

group :development, :test do 
    gem 'sqlite3' 
    ... 

我運行這個 捆綁安裝--without生產 另一個應用我正在工作關於我導入Postgress以避免開發和生產環境之間的任何可能的錯誤