Ruby on rails RubyonRails-Heroku部署上未初始化的常量CarrierWave(NameError)

Ruby on rails RubyonRails-Heroku部署上未初始化的常量CarrierWave(NameError),ruby-on-rails,heroku,imagemagick,carrierwave,Ruby On Rails,Heroku,Imagemagick,Carrierwave,我正在尝试将一个应用程序从Cloud9Rails实例部署到Heroku。部署成功完成,但应用程序启动时崩溃。此外,无法加载Heroku rails控制台-请参阅下面的错误。我是新手 在安装之前,我在本地box和cloud9上遇到imagemagick问题。不知道如何在Heroku实例上实现这一点,如果这真的是我的问题。欢迎提出想法、建议和问题 $ heroku run rails console Running rails console on ⬢ bttttt-xxxxxxxs-888888.

我正在尝试将一个应用程序从Cloud9Rails实例部署到Heroku。部署成功完成,但应用程序启动时崩溃。此外,无法加载Heroku rails控制台-请参阅下面的错误。我是新手

在安装之前,我在本地box和cloud9上遇到imagemagick问题。不知道如何在Heroku实例上实现这一点,如果这真的是我的问题。欢迎提出想法、建议和问题

$ heroku run rails console
Running rails console on ⬢ bttttt-xxxxxxxs-888888... up, run.9920 (Free)
/app/app/uploaders/image_uploader.rb:1:in `<top (required)>': uninitialized constant CarrierWave (NameError)
    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
    from /app/app/models/restaurant.rb:2:in `<class:Restaurant>'
    from /app/app/models/restaurant.rb:1:in `<top (required)>'
    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
    from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:475:in `each'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:475:in `block in eager_load!'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:473:in `each'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:473:in `eager_load!'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:354:in `eager_load!'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application/finisher.rb:59:in `each'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:30:in `instance_exec'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:30:in `run'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `call'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
    from /app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:54:in `run_initializers'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application.rb:352:in `initialize!'
    from /app/config/environment.rb:5:in `<top (required)>'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application.rb:328:in `require'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application.rb:328:in `require_environment!'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:157:in `require_application_and_environment!'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:77:in `console'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands.rb:18:in `<top (required)>'
    from /app/bin/rails:9:in `require'
    from /app/bin/rails:9:in `<main>'
$heroku运行rails控制台
运行rails控制台⬢ bttttt-XXXXXX S-8888888。。。启动,运行0.9920(免费)
/app/app/uploaders/image_uploader.rb:1:in`':未初始化的常量CarrierWave(NameError)
来自/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active\u-support/dependencies/interlock.rb:12:“加载中的块”中
from/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active\u support/concurrency/share\u lock.rb:150:在“独占”中
来自/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active\u-support/dependencies/interlock.rb:11:在“加载”中
from/app/app/models/restaurant.rb:2:in`'
from/app/app/models/restaurant.rb:1:in`'
来自/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active\u-support/dependencies/interlock.rb:12:“加载中的块”中
from/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active\u support/concurrency/share\u lock.rb:150:在“独占”中
来自/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.4/lib/active\u-support/dependencies/interlock.rb:11:在“加载”中
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:476:in'block(2层)in eager_load!'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:475:in'each'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:475:in'block in eager_load!'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:473:in'each'
来自/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:473:in'eager_load!'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/engine.rb:354:in'eager_load!'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application/finisher.rb:59:in'each'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application/finisher.rb:59:in'block-in'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:30:in'instance_exec'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:30:in'run'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:55:“运行中的块初始化器”
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:228:in'block in tsort_each'
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:350:在每个强连接的组件中的“块(2级)”中
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:431:in'each_strength_connected_component_from'
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:349:in“每个强连接的组件中的块”
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in'each'
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in'call'
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:“每个强连接的组件”
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:226:in'tsort_each'
from/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:205:in'tsort_each'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/initializable.rb:54:in'run_initializers'
来自/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application.rb:352:in'initialize!'
from/app/config/environment.rb:5:in`'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application.rb:328:in'require'
来自/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/application.rb:328:in'require_environment!'
来自/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands\u tasks.rb:157:“需要应用程序和环境!”
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:77:in'console'
from/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands/commands\u tasks.rb:49:in'run\u command!'
来自/app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.4/lib/rails/commands.rb:18:in`'
from/app/bin/rails:9:in'require'
from/app/bin/rails:9:in`'
文件代码-

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
  gem 'sqlite3'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'carrierwave'
  gem 'mini_magick'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :production do
  gem 'pg', '0.20.0'
end
源代码'https://rubygems.org'
git_源(:github)do | repo_名称|
repo_name=“#{repo_name}/#{repo_name}”除非repo_name.include?(“/”)
"https://github.com/#{repo_name}.git“
结束
#捆绑边缘Rails:gem'Rails',github'Rails/Rails'
gem'rails',“~>5.0.1”
#使用sqlite3作为活动记录的数据库
#gem'sqlite3'
#使用Puma作为应用程序服务器
宝石“彪马”,“~>3.0”
#将SCS用于样式表
gem'sass-rails',“~>5.0”
#使用Uglifier作为JavaScript资产的压缩器
gem'uglifier','>=1.3.0'
#将CoffeeScript用于.coffee资产和视图
gem“咖啡轨”,“~>4.2”
#看https://github.com/rails/execjs#readme 获取更多受支持的运行时
#宝石“therubyracer”,平台::ruby
#使用jquery作为JavaScript库
gem'jqueryrails'
#Turbolinks使web应用程序的导航速度更快。阅读更多:https://github.com/turbolinks/turbolinks
gem“涡轮链接”,“大于5”
#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder',“~>2.5”
#使用Redis适配器在生产中运行操作电缆
#gem'redis',“~>3.0”
#使用ActiveModel具有\u安全\u密码
gem'bcrypt',“~>3.1.7”
#使用Capistrano进行部署
#gem“capistrano rails”,集团::开发
小组:开发,:测试
#在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台
gem'byebug',平台::mri
gem'sqlite3'
结束
小组:发展怎么办
source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'carrierwave'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
  gem 'sqlite3'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'mini_magick'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :production do
  gem 'pg', '0.20.0'
end
group :development, :production do
  gem 'carrierwave'
end