ruby-on-rails - 将应用程序部署到 Heroku : 'NameError: uninitialized constant Devise'

标签 ruby-on-rails git heroku devise

我想将我的 Rails 应用程序部署到 Heroku。当然,我还包括一些额外的 gem,例如“devise”或“rails_admin”。我严格遵循 Rails Girls 的教程 (http://guides.railsgirls.com/heroku/)。我在运行 git push heroku master 时遇到了一些非常烦人的问题。

Counting objects: 220, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (198/198), done.
Writing objects: 100% (220/220), 94.69 KiB | 0 bytes/s, done.
Total 220 (delta 21), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using 1.7.12
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:        Installing i18n 0.7.0
remote:        Installing rake 10.4.2
remote:        Installing minitest 5.5.1
remote:        Installing thread_safe 0.3.4
remote:        Installing builder 3.2.2
remote:        Installing erubis 2.7.0
remote:        Installing mini_portile 0.6.2
remote:        Installing mime-types 2.4.3
remote:        Installing rack 1.6.0
remote:        Installing arel 6.0.0
remote:        Installing coffee-script-source 1.8.0
remote:        Installing execjs 2.2.2
remote:        Installing thor 0.19.1
remote:        Installing hike 1.2.3
remote:        Installing multi_json 1.10.1
remote:        Using bundler 1.7.12
remote:        Installing tilt 1.4.1
remote:        Installing rails_serve_static_assets 0.0.4
remote:        Installing rails_stdout_logging 0.0.3
remote:        Installing sass 3.4.10
remote:        Installing tzinfo 1.2.2
remote:        Installing json 1.8.2
remote:        Installing mail 2.6.3
remote:        Installing rack-test 0.6.3
remote:        Installing coffee-script 2.3.0
remote:        Installing sprockets 2.12.3
remote:        Installing rails_12factor 0.0.3
remote:        Installing activesupport 4.2.0.rc3
remote:        Installing rdoc 4.2.0
remote:        Installing uglifier 2.7.0
remote:        Installing rails-deprecated_sanitizer 1.0.3
remote:        Installing globalid 0.3.0
remote:        Installing activemodel 4.2.0.rc3
remote:        Installing jbuilder 2.2.6
remote:        Installing sdoc 0.4.1
remote:        Installing activejob 4.2.0.rc3
remote:        Installing activerecord 4.2.0.rc3
remote:        Installing nokogiri 1.6.6.2
remote:        Installing pg 0.18.1
remote:        Installing loofah 2.0.1
remote:        Installing rails-dom-testing 1.0.5
remote:        Installing rails-html-sanitizer 1.0.1
remote:        Installing actionview 4.2.0.rc3
remote:        Installing actionpack 4.2.0.rc3
remote:        Installing actionmailer 4.2.0.rc3
remote:        Installing sprockets-rails 2.2.4
remote:        Installing railties 4.2.0.rc3
remote:        Installing coffee-rails 4.1.0
remote:        Installing jquery-rails 4.0.1
remote:        Installing rails 4.2.0.rc3
remote:        Installing sass-rails 5.0.1
remote:        Installing turbolinks 2.5.3
remote:        Your bundle is complete!
remote:        Gems in the groups development and test were not installed.
remote:        It was installed into ./vendor/bundle
remote:        Post-install message from rdoc:
remote:        Depending on your version of ruby, you may need to install ruby rdoc/ri data:
remote:        <= 1.8.6 : unsupported
remote:        = 1.8.7 : gem install rdoc-data; rdoc-data --install
remote:        = 1.9.1 : gem install rdoc-data; rdoc-data --install
remote:        >= 1.9.2 : nothing to do! Yay!
remote:        Bundle completed (35.01s)
remote:        Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        NameError: uninitialized constant Devise
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/config/initializers/devise.rb:3:in '<top (required)>'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:652:in 'block in load_config_initializer'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0.rc3/lib/active_support/notifications.rb:166:in 'instrument'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:651:in 'load_config_initializer'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:616:in 'block (2 levels) in <class:Engine>'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:615:in 'each'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:615:in 'block in <class:Engine>'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:30:in 'instance_exec'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:30:in 'run'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:55:in 'block in run_initializers'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:44:in 'each'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:44:in 'tsort_each_child'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:54:in 'run_initializers'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/application.rb:352:in 'initialize!'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/config/environment.rb:5:in '<top (required)>'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/application.rb:328:in 'require'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/application.rb:328:in 'require_environment!'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0.rc3/lib/rails/application.rb:443:in 'block in run_tasks_blocks'
remote:        /tmp/build_8bd0cbc64dad003f3588b01ead189e3c/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.2.4/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 powerful-taiga-2060.
remote: 
To https://git.heroku.com/powerful-taiga-2060.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/powerful-taiga-2060.git`

这是我的 Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.0.rc3'
group :development do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
  gem 'rails_12factor'
end
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :production, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'spring'
  gem 'bootstrap-generators', '~> 3.3.1'
  gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
  gem 'rails_admin'
  gem 'mocha'
  gem 'nifty-generators'
  gem 'jquery-turbolinks'
  gem 'devise'
end

问题一定出在 rake assets:precompile 上。 谁能帮帮我?这个问题确实拖慢了我的 Rails Adventure。

最佳答案

你的 gem 都没有

group :development, :production, :test do

是根据 Heroku 日志安装的。尝试将它们放在组之外。

关于ruby-on-rails - 将应用程序部署到 Heroku : 'NameError: uninitialized constant Devise' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28508575/

相关文章:

javascript - 如何在 Rails 7 中将 clipboard.js 与 importmap 一起使用

sql - ActiveRecord 中多列的索引

ruby-on-rails - Postgres 随机停止工作(Rails,PGSQL.5432)

ruby-on-rails - rake 中止! PG::ConnectionBad:fe_sendauth:未提供密码任务:TOP => db:migrate(通过使用 --trace 运行任务查看完整跟踪)

ruby-on-rails - 使用 json 发送 post 请求来设计注册

linux - 如何从 Linux 终端将我的工作推送到 Github 上的存储库?

git - 如何判断当前工作目录是否被 Git 忽略?

git - 使用 git 分支作为源的 Terraform 模块

ruby-on-rails - 我需要对生产应用修补程序,但我没有创建分支,我该怎么办?

node.js - 在 Heroku 上找不到 librdkafka