0

アプリケーションを Heroku にデプロイしようとしています。私はRails 4、最新のDevise(3.0.0.rcリポジトリから両方を試した)とruby 1.9.3(2.0も試しました)を使用しています。初期プッシュを通過できません。heroku がデバイスを認識していないようです。ローカルassets:precompileタスクは問題なく実行されます。出力は次のとおりです。

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
4

5 に答える 5

1

therubyracer gem は役に立たないと思います。私自身は使用していませんが、この特定の問題に遭遇したことはありません。また、Heroku は大量のメモリを使用するため、gem の使用を推奨していません。代わりに 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

Devise のドキュメントによると、これは Heroku で Rails 3.1 を使用する Devise に必要です。あなたがRails 4を使用していることは知っているので、これは役に立たないかもしれませんが、最初にデータベースを作成できない場合は、試してみる価値があるようです.

于 2014-04-15T02:15:29.377 に答える
1

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

これは、Rails4 や Devise ではなく、Asset パイプラインの問題です。

于 2013-07-05T16:15:36.897 に答える
0

Gemfile に therubyracer の gem をインストールしていません。

于 2013-07-08T10:44:14.957 に答える
0

この問題はありませんでしたが、私のセットアップはこの gemfile のように見えます

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

環境 (c9) で、このバンドル インストールを実行します – 実稼働なし

于 2016-03-11T00:31:11.720 に答える