繁体   English   中英

Rail“无法加载此类文件-机架/处理机/ rails__env =生产(LoadError)”

[英]Rail “cannot load such file — rack/handler/rails__env=production (LoadError)”

我是新手。 我的Rails应用程序在开发模式下运行良好。 但是,当我运行“ rails server RAILS_ENV = production”时,标题中出现了错误消息。 当在Heroku上部署时,该应用程序页面还会显示“出了点问题”。 我使用CSS并添加了图像样式。

我已经运行了“ rake asset:precompile”和“ RAILS_ENV =生产包执行rake asset:precompile”,但这似乎没有任何改变。

我还设置了秘密基本密钥。

我现在很困惑。

这是我的database.yml文件:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: db/test.sqlite3

production:
  <<: *default
  database: db/production.sqlite3

config / environments / production.rb文件

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
  # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
  # `config/secrets.yml.key`.
  config.read_encrypted_secrets = true

  # Disable serving static files from the `/public` folder by default since
  # Apache or NGINX already handles this.
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

  # Compress JavaScripts and CSS.
  config.assets.js_compressor = :uglifier
  # config.assets.css_compressor = :sass

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = false

  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb

  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
  # config.action_controller.asset_host = 'http://assets.example.com'

  # Specifies the header that your server uses for sending files.
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

  # Mount Action Cable outside main process or domain
  # config.action_cable.mount_path = nil
  # config.action_cable.url = 'wss://example.com/cable'
  # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # Use the lowest log level to ensure availability of diagnostic information
  # when problems arise.
  config.log_level = :debug

  # Prepend all log lines with the following tags.
  config.log_tags = [ :request_id ]

  # Use a different cache store in production.
  # config.cache_store = :mem_cache_store

  # Use a real queuing backend for Active Job (and separate queues per environment)
  # config.active_job.queue_adapter     = :resque
  # config.active_job.queue_name_prefix = "sample_app_#{Rails.env}"
  config.action_mailer.perform_caching = false

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  # config.action_mailer.raise_delivery_errors = false

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation cannot be found).
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners.
  config.active_support.deprecation = :notify

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # Use a different logger for distributed setups.
  # require 'syslog/logger'
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
  end

  # Do not dump schema after migrations.
  config.active_record.dump_schema_after_migration = false
end

production.log:

D, [2019-01-08T17:10:25.357047 #7073] DEBUG -- :   [1m[35m (0.1ms)[0m  [1m[34mSELECT sqlite_version(*)[0m
D, [2019-01-08T17:10:25.363611 #7073] DEBUG -- :   [1m[35m (6.4ms)[0m  [1m[35mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)[0m
D, [2019-01-08T17:10:25.378994 #7073] DEBUG -- :   [1m[35m (6.8ms)[0m  [1m[35mCREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
D, [2019-01-08T17:10:25.389773 #7073] DEBUG -- :   [1m[35m (0.1ms)[0m  [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
I, [2019-01-08T17:10:25.389869 #7073]  INFO -- : Migrating to CreateUsers (20190107033135)
D, [2019-01-08T17:10:25.392644 #7073] DEBUG -- :   [1m[35m (0.1ms)[0m  [1m[36mbegin transaction[0m
D, [2019-01-08T17:10:25.394747 #7073] DEBUG -- :   [1m[35m (1.5ms)[0m  [1m[35mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "email" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
D, [2019-01-08T17:10:25.398043 #7073] DEBUG -- :   [1m[35mSQL (0.1ms)[0m  [1m[32mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m  [["version", "20190107033135"]]
D, [2019-01-08T17:10:25.409467 #7073] DEBUG -- :   [1m[35m (11.2ms)[0m  [1m[36mcommit transaction[0m
I, [2019-01-08T17:10:25.409571 #7073]  INFO -- : Migrating to AddPasswordDigestToUsers (20190108070109)
D, [2019-01-08T17:10:25.410533 #7073] DEBUG -- :   [1m[35m (0.1ms)[0m  [1m[36mbegin transaction[0m
D, [2019-01-08T17:10:25.412416 #7073] DEBUG -- :   [1m[35m (1.5ms)[0m  [1m[35mALTER TABLE "users" ADD "password_digest" varchar[0m
D, [2019-01-08T17:10:25.413900 #7073] DEBUG -- :   [1m[35mSQL (0.2ms)[0m  [1m[32mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m  [["version", "20190108070109"]]
D, [2019-01-08T17:10:25.419022 #7073] DEBUG -- :   [1m[35m (4.8ms)[0m  [1m[36mcommit transaction[0m
D, [2019-01-08T17:10:25.426027 #7073] DEBUG -- :   [1m[36mActiveRecord::InternalMetadata Load (0.2ms)[0m  [1m[34mSELECT  "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m  [["key", "environment"], ["LIMIT", 1]]
D, [2019-01-08T17:10:25.438559 #7073] DEBUG -- :   [1m[35m (0.1ms)[0m  [1m[36mbegin transaction[0m
D, [2019-01-08T17:10:25.440730 #7073] DEBUG -- :   [1m[35mSQL (1.3ms)[0m  [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)[0m  [["key", "environment"], ["value", "production"], ["created_at", "2019-01-08 09:10:25.438804"], ["updated_at", "2019-01-08 09:10:25.438804"]]
D, [2019-01-08T17:10:25.443677 #7073] DEBUG -- :   [1m[35m (2.8ms)[0m  [1m[36mcommit transaction[0m
I, [2019-01-08T22:16:22.532530 #17657]  INFO -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9] Started GET "/" for 127.0.0.1 at 2019-01-08 22:16:22 +0800
I, [2019-01-08T22:16:22.539041 #17657]  INFO -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9] Processing by StaticPagesController#home as HTML
I, [2019-01-08T22:16:22.557513 #17657]  INFO -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9]   Rendering static_pages/home.html.erb within layouts/application
I, [2019-01-08T22:16:22.562687 #17657]  INFO -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9]   Rendered static_pages/home.html.erb within layouts/application (5.0ms)
I, [2019-01-08T22:16:22.562880 #17657]  INFO -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9] Completed 500 Internal Server Error in 24ms
F, [2019-01-08T22:16:22.563908 #17657] FATAL -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9]   
F, [2019-01-08T22:16:22.563949 #17657] FATAL -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9] ActionView::Template::Error (The asset "cat.jpeg" is not present in the asset pipeline.):
F, [2019-01-08T22:16:22.564060 #17657] FATAL -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9]     10: </div>
[c0464130-5e13-4634-8d0f-10cbcf05a7c9]     11: 
[c0464130-5e13-4634-8d0f-10cbcf05a7c9]     12: <div class="center">
[c0464130-5e13-4634-8d0f-10cbcf05a7c9]     13: <%= link_to image_tag("cat.jpeg", alt: "Cat logo"),
[c0464130-5e13-4634-8d0f-10cbcf05a7c9]     14:     'http://rubyonrails.org' %>
[c0464130-5e13-4634-8d0f-10cbcf05a7c9]     15: </div>
F, [2019-01-08T22:16:22.564097 #17657] FATAL -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9]   
F, [2019-01-08T22:16:22.564123 #17657] FATAL -- : [c0464130-5e13-4634-8d0f-10cbcf05a7c9] app/views/static_pages/home.html.erb:13:in `_app_views_static_pages_home_html_erb__3702704161608906257_47204760052880'
I, [2019-01-08T22:16:23.922999 #17657]  INFO -- : [6e17805c-762e-46b7-9b5f-729658819f90] Started GET "/" for 127.0.0.1 at 2019-01-08 22:16:23 +0800
I, [2019-01-08T22:16:23.923668 #17657]  INFO -- : [6e17805c-762e-46b7-9b5f-729658819f90] Processing by StaticPagesController#home as HTML
I, [2019-01-08T22:16:23.924316 #17657]  INFO -- : [6e17805c-762e-46b7-9b5f-729658819f90]   Rendering static_pages/home.html.erb within layouts/application
I, [2019-01-08T22:16:23.925411 #17657]  INFO -- : [6e17805c-762e-46b7-9b5f-729658819f90]   Rendered static_pages/home.html.erb within layouts/application (1.0ms)
I, [2019-01-08T22:16:23.925590 #17657]  INFO -- : [6e17805c-762e-46b7-9b5f-729658819f90] Completed 500 Internal Server Error in 2ms
F, [2019-01-08T22:16:23.931329 #17657] FATAL -- : [6e17805c-762e-46b7-9b5f-729658819f90]   
F, [2019-01-08T22:16:23.931422 #17657] FATAL -- : [6e17805c-762e-46b7-9b5f-729658819f90] ActionView::Template::Error (The asset "cat.jpeg" is not present in the asset pipeline.):
F, [2019-01-08T22:16:23.931555 #17657] FATAL -- : [6e17805c-762e-46b7-9b5f-729658819f90]     10: </div>
[6e17805c-762e-46b7-9b5f-729658819f90]     11: 
[6e17805c-762e-46b7-9b5f-729658819f90]     12: <div class="center">
[6e17805c-762e-46b7-9b5f-729658819f90]     13: <%= link_to image_tag("cat.jpeg", alt: "Cat logo"),
[6e17805c-762e-46b7-9b5f-729658819f90]     14:     'http://rubyonrails.org' %>
[6e17805c-762e-46b7-9b5f-729658819f90]     15: </div>
F, [2019-01-08T22:16:23.931581 #17657] FATAL -- : [6e17805c-762e-46b7-9b5f-729658819f90]   
F, [2019-01-08T22:16:23.931605 #17657] FATAL -- : [6e17805c-762e-46b7-9b5f-729658819f90] app/views/static_pages/home.html.erb:13:in `_app_views_static_pages_home_html_erb__3702704161608906257_47204760052880'
I, [2019-01-08T22:16:35.216117 #17657]  INFO -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26] Started GET "/" for 127.0.0.1 at 2019-01-08 22:16:35 +0800
I, [2019-01-08T22:16:35.216701 #17657]  INFO -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26] Processing by StaticPagesController#home as HTML
I, [2019-01-08T22:16:35.217283 #17657]  INFO -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26]   Rendering static_pages/home.html.erb within layouts/application
I, [2019-01-08T22:16:35.218220 #17657]  INFO -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26]   Rendered static_pages/home.html.erb within layouts/application (0.9ms)
I, [2019-01-08T22:16:35.218324 #17657]  INFO -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26] Completed 500 Internal Server Error in 2ms
F, [2019-01-08T22:16:35.221370 #17657] FATAL -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26]   
F, [2019-01-08T22:16:35.221453 #17657] FATAL -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26] ActionView::Template::Error (The asset "cat.jpeg" is not present in the asset pipeline.):
F, [2019-01-08T22:16:35.221604 #17657] FATAL -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26]     10: </div>
[ba2e99f7-7388-4d98-b3e8-24699961ce26]     11: 
[ba2e99f7-7388-4d98-b3e8-24699961ce26]     12: <div class="center">
[ba2e99f7-7388-4d98-b3e8-24699961ce26]     13: <%= link_to image_tag("cat.jpeg", alt: "Cat logo"),
[ba2e99f7-7388-4d98-b3e8-24699961ce26]     14:     'http://rubyonrails.org' %>
[ba2e99f7-7388-4d98-b3e8-24699961ce26]     15: </div>
F, [2019-01-08T22:16:35.221634 #17657] FATAL -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26]   
F, [2019-01-08T22:16:35.221659 #17657] FATAL -- : [ba2e99f7-7388-4d98-b3e8-24699961ce26] app/views/static_pages/home.html.erb:13:in `_app_views_static_pages_home_html_erb__3702704161608906257_47204760052880'
I, [2019-01-08T22:19:06.415479 #17772]  INFO -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617] Started GET "/" for 127.0.0.1 at 2019-01-08 22:19:06 +0800
I, [2019-01-08T22:19:06.464918 #17772]  INFO -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617] Processing by StaticPagesController#home as HTML
I, [2019-01-08T22:19:06.481732 #17772]  INFO -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617]   Rendering static_pages/home.html.erb within layouts/application
I, [2019-01-08T22:19:06.483232 #17772]  INFO -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617]   Rendered static_pages/home.html.erb within layouts/application (1.4ms)
I, [2019-01-08T22:19:06.487443 #17772]  INFO -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617] Completed 500 Internal Server Error in 18ms
F, [2019-01-08T22:19:06.489384 #17772] FATAL -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617]   
F, [2019-01-08T22:19:06.489432 #17772] FATAL -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617] ActionView::Template::Error (The asset "cat.jpeg" is not present in the asset pipeline.):
F, [2019-01-08T22:19:06.489538 #17772] FATAL -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617]     10: </div>
[e767e84b-ad18-4665-b34d-8fe6f06c1617]     11: 
[e767e84b-ad18-4665-b34d-8fe6f06c1617]     12: <div class="center">
[e767e84b-ad18-4665-b34d-8fe6f06c1617]     13: <%= link_to image_tag("cat.jpeg", alt: "Cat logo"),
[e767e84b-ad18-4665-b34d-8fe6f06c1617]     14:     'http://rubyonrails.org' %>
[e767e84b-ad18-4665-b34d-8fe6f06c1617]     15: </div>
F, [2019-01-08T22:19:06.489562 #17772] FATAL -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617]   
F, [2019-01-08T22:19:06.489586 #17772] FATAL -- : [e767e84b-ad18-4665-b34d-8fe6f06c1617] app/views/static_pages/home.html.erb:13:in `_app_views_static_pages_home_html_erb___2313651232112027984_46983187185460'
I, [2019-01-08T22:19:06.775918 #17772]  INFO -- : [3ff8acbe-1d21-4b7d-9931-5408bdace3a7] Started GET "/favicon.ico" for 127.0.0.1 at 2019-01-08 22:19:06 +0800
F, [2019-01-08T22:19:06.776587 #17772] FATAL -- : [3ff8acbe-1d21-4b7d-9931-5408bdace3a7]   
F, [2019-01-08T22:19:06.776629 #17772] FATAL -- : [3ff8acbe-1d21-4b7d-9931-5408bdace3a7] ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
F, [2019-01-08T22:19:06.776653 #17772] FATAL -- : [3ff8acbe-1d21-4b7d-9931-5408bdace3a7]   
F, [2019-01-08T22:19:06.776684 #17772] FATAL -- : [3ff8acbe-1d21-4b7d-9931-5408bdace3a7] actionpack (5.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:63:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] actionpack (5.1.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] railties (5.1.6) lib/rails/rack/logger.rb:36:in `call_app'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] railties (5.1.6) lib/rails/rack/logger.rb:24:in `block in call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `block in tagged'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] activesupport (5.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `tagged'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] railties (5.1.6) lib/rails/rack/logger.rb:24:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] actionpack (5.1.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] actionpack (5.1.6) lib/action_dispatch/middleware/request_id.rb:25:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] rack (2.0.6) lib/rack/method_override.rb:22:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] rack (2.0.6) lib/rack/runtime.rb:22:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] activesupport (5.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] rack (2.0.6) lib/rack/sendfile.rb:111:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] railties (5.1.6) lib/rails/engine.rb:522:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] puma (3.9.1) lib/puma/configuration.rb:224:in `call'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] puma (3.9.1) lib/puma/server.rb:602:in `handle_request'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] puma (3.9.1) lib/puma/server.rb:435:in `process_client'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] puma (3.9.1) lib/puma/server.rb:299:in `block in run'
[3ff8acbe-1d21-4b7d-9931-5408bdace3a7] puma (3.9.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
I, [2019-01-08T23:12:04.655503 #18495]  INFO -- : [858614f1-263c-4425-ad29-28216da4ba7c] Started GET "/" for 127.0.0.1 at 2019-01-08 23:12:04 +0800
I, [2019-01-08T23:12:04.664984 #18495]  INFO -- : [858614f1-263c-4425-ad29-28216da4ba7c] Processing by StaticPagesController#home as HTML
I, [2019-01-08T23:12:04.683226 #18495]  INFO -- : [858614f1-263c-4425-ad29-28216da4ba7c]   Rendering static_pages/home.html.erb within layouts/application
I, [2019-01-08T23:12:04.685590 #18495]  INFO -- : [858614f1-263c-4425-ad29-28216da4ba7c]   Rendered static_pages/home.html.erb within layouts/application (2.1ms)
I, [2019-01-08T23:12:04.689870 #18495]  INFO -- : [858614f1-263c-4425-ad29-28216da4ba7c] Completed 500 Internal Server Error in 25ms
F, [2019-01-08T23:12:04.690919 #18495] FATAL -- : [858614f1-263c-4425-ad29-28216da4ba7c]   
F, [2019-01-08T23:12:04.690961 #18495] FATAL -- : [858614f1-263c-4425-ad29-28216da4ba7c] ActionView::Template::Error (The asset "cat.jpeg" is not present in the asset pipeline.):
F, [2019-01-08T23:12:04.691131 #18495] FATAL -- : [858614f1-263c-4425-ad29-28216da4ba7c]     10: </div>
[858614f1-263c-4425-ad29-28216da4ba7c]     11: 
[858614f1-263c-4425-ad29-28216da4ba7c]     12: <div class="center">
[858614f1-263c-4425-ad29-28216da4ba7c]     13: <%= link_to image_tag("cat.jpeg", alt: "Cat logo"),
[858614f1-263c-4425-ad29-28216da4ba7c]     14:     'http://rubyonrails.org' %>
[858614f1-263c-4425-ad29-28216da4ba7c]     15: </div>
F, [2019-01-08T23:12:04.691166 #18495] FATAL -- : [858614f1-263c-4425-ad29-28216da4ba7c]   
F, [2019-01-08T23:12:04.691193 #18495] FATAL -- : [858614f1-263c-4425-ad29-28216da4ba7c] app/views/static_pages/home.html.erb:13:in `_app_views_static_pages_home_html_erb__2565625493209092932_47386803073300'
I, [2019-01-08T23:12:05.013639 #18495]  INFO -- : [412499ac-0294-4208-8ef0-bcba8d7a7b2f] Started GET "/favicon.ico" for 127.0.0.1 at 2019-01-08 23:12:05 +0800
F, [2019-01-08T23:12:05.014374 #18495] FATAL -- : [412499ac-0294-4208-8ef0-bcba8d7a7b2f]   
F, [2019-01-08T23:12:05.014436 #18495] FATAL -- : [412499ac-0294-4208-8ef0-bcba8d7a7b2f] ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
F, [2019-01-08T23:12:05.014473 #18495] FATAL -- : [412499ac-0294-4208-8ef0-bcba8d7a7b2f]   
F, [2019-01-08T23:12:05.014517 #18495] FATAL -- : [412499ac-0294-4208-8ef0-bcba8d7a7b2f] actionpack (5.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:63:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] actionpack (5.1.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] railties (5.1.6) lib/rails/rack/logger.rb:36:in `call_app'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] railties (5.1.6) lib/rails/rack/logger.rb:24:in `block in call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `block in tagged'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] activesupport (5.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `tagged'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] railties (5.1.6) lib/rails/rack/logger.rb:24:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] actionpack (5.1.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] actionpack (5.1.6) lib/action_dispatch/middleware/request_id.rb:25:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] rack (2.0.6) lib/rack/method_override.rb:22:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] rack (2.0.6) lib/rack/runtime.rb:22:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] activesupport (5.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] rack (2.0.6) lib/rack/sendfile.rb:111:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] railties (5.1.6) lib/rails/engine.rb:522:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] puma (3.9.1) lib/puma/configuration.rb:224:in `call'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] puma (3.9.1) lib/puma/server.rb:602:in `handle_request'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] puma (3.9.1) lib/puma/server.rb:435:in `process_client'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] puma (3.9.1) lib/puma/server.rb:299:in `block in run'
[412499ac-0294-4208-8ef0-bcba8d7a7b2f] puma (3.9.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
I, [2019-01-08T23:12:09.482461 #18495]  INFO -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163] Started GET "/" for 127.0.0.1 at 2019-01-08 23:12:09 +0800
I, [2019-01-08T23:12:09.483182 #18495]  INFO -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163] Processing by StaticPagesController#home as HTML
I, [2019-01-08T23:12:09.483849 #18495]  INFO -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163]   Rendering static_pages/home.html.erb within layouts/application
I, [2019-01-08T23:12:09.484923 #18495]  INFO -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163]   Rendered static_pages/home.html.erb within layouts/application (1.0ms)
I, [2019-01-08T23:12:09.485027 #18495]  INFO -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163] Completed 500 Internal Server Error in 2ms
F, [2019-01-08T23:12:09.486572 #18495] FATAL -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163]   
F, [2019-01-08T23:12:09.486679 #18495] FATAL -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163] ActionView::Template::Error (The asset "cat.jpeg" is not present in the asset pipeline.):
F, [2019-01-08T23:12:09.486855 #18495] FATAL -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163]     10: </div>
[5b65a6f0-4544-4092-a0f8-971e68a3a163]     11: 
[5b65a6f0-4544-4092-a0f8-971e68a3a163]     12: <div class="center">
[5b65a6f0-4544-4092-a0f8-971e68a3a163]     13: <%= link_to image_tag("cat.jpeg", alt: "Cat logo"),
[5b65a6f0-4544-4092-a0f8-971e68a3a163]     14:     'http://rubyonrails.org' %>
[5b65a6f0-4544-4092-a0f8-971e68a3a163]     15: </div>
F, [2019-01-08T23:12:09.486881 #18495] FATAL -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163]   
F, [2019-01-08T23:12:09.486955 #18495] FATAL -- : [5b65a6f0-4544-4092-a0f8-971e68a3a163] app/views/static_pages/home.html.erb:13:in `_app_views_static_pages_home_html_erb__2565625493209092932_47386803073300'
I, [2019-01-08T23:13:02.176411 #18521]  INFO -- : [7093aa4a-ce55-426e-be7c-db8144a4931b] Started GET "/" for 127.0.0.1 at 2019-01-08 23:13:02 +0800
I, [2019-01-08T23:13:02.187432 #18521]  INFO -- : [7093aa4a-ce55-426e-be7c-db8144a4931b] Processing by StaticPagesController#home as HTML
I, [2019-01-08T23:13:02.205465 #18521]  INFO -- : [7093aa4a-ce55-426e-be7c-db8144a4931b]   Rendering static_pages/home.html.erb within layouts/application
I, [2019-01-08T23:13:02.209532 #18521]  INFO -- : [7093aa4a-ce55-426e-be7c-db8144a4931b]   Rendered static_pages/home.html.erb within layouts/application (3.9ms)
I, [2019-01-08T23:13:02.209752 #18521]  INFO -- : [7093aa4a-ce55-426e-be7c-db8144a4931b] Completed 500 Internal Server Error in 22ms
F, [2019-01-08T23:13:02.211944 #18521] FATAL -- : [7093aa4a-ce55-426e-be7c-db8144a4931b]   
F, [2019-01-08T23:13:02.212100 #18521] FATAL -- : [7093aa4a-ce55-426e-be7c-db8144a4931b] ActionView::Template::Error (The asset "cat.jpeg" is not present in the asset pipeline.):
F, [2019-01-08T23:13:02.212263 #18521] FATAL -- : [7093aa4a-ce55-426e-be7c-db8144a4931b]     10: </div>
[7093aa4a-ce55-426e-be7c-db8144a4931b]     11: 
[7093aa4a-ce55-426e-be7c-db8144a4931b]     12: <div class="center">
[7093aa4a-ce55-426e-be7c-db8144a4931b]     13: <%= link_to image_tag("cat.jpeg", alt: "Cat logo"),
[7093aa4a-ce55-426e-be7c-db8144a4931b]     14:     'http://rubyonrails.org' %>
[7093aa4a-ce55-426e-be7c-db8144a4931b]     15: </div>
F, [2019-01-08T23:13:02.214315 #18521] FATAL -- : [7093aa4a-ce55-426e-be7c-db8144a4931b]   
F, [2019-01-08T23:13:02.214366 #18521] FATAL -- : [7093aa4a-ce55-426e-be7c-db8144a4931b] app/views/static_pages/home.html.erb:13:in `_app_views_static_pages_home_html_erb___1013939282347745016_47015315334380'

感谢您的帮助/提示/建议!

正确的命令如下:

rails server -e production 

我想这也可行:

RAILS_ENV=production rails s

如果您在计算机上运行,​​则应调用以下命令:

bundle exec rails server -e production

在heroku中,您无需执行任何操作。 它会检测到您正在运行Ruby on Rails应用程序,并编译资产并使用正确的rails server命令启动资产。

看一下heroku中的日志:

heroku logs

最常见的错误是,如果运行了案例,则忘记运行迁移:

heroku run rake db:migrate

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM