config.assets.compile = false-使Heroku在生产中不显示我的图像

时间:2018-08-21 08:44:48

标签: ruby-on-rails heroku ruby-on-rails-5

所以我试图使我的Rails应用程序尽可能快,我在这里读到,如果我将config.assets.compile设置为false。当这是真的,我通过终端推送代码时,终端中的脚本会说拥有set = true可能会影响我的应用程序的性能。

无论如何,现在我将其设置为false,则没有任何图像显示。 这是我的production.rb:

Rails.application.configure do
      config.action_mailer.default_url_options = { host: "http://TODO_PUT_YOUR_DOMAIN_HERE" }
      # Verifies that versions and hashed value of the package contents in the project's package.json
      config.webpacker.check_yarn_integrity = false
      # Settings specified here will take precedence over those in config/application.rb.

      # Code is not reloaded between requests.
      config.cache_classes = true
      config.action_controller.perform_caching = 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

      # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
      # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
      # config.require_master_key = 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.action_controller.perform_caching = true
      # `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

      # Store uploaded files on the local file system (see config/storage.yml for options)
      config.active_storage.service = :local

      # 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 ]
      config.serve_static_assets = true


      # 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 = "Hoxton-Technologica_#{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

这是我的开发。rb

      Rails.application.configure do
      config.action_mailer.default_url_options = { host: "http://localhost:3000" }
      # Verifies that versions and hashed value of the package contents in the project's package.json
      config.webpacker.check_yarn_integrity = true
      # Settings specified here will take precedence over those in config/application.rb.

      # In the development environment your application's code is reloaded on
      # every request. This slows down response time but is perfect for development
      # since you don't have to restart the web server when you make code changes.
      config.cache_classes = false
      config.action_controller.perform_caching = true

      # Do not eager load code on boot.
      config.eager_load = false

      # Show full error reports.
      config.consider_all_requests_local = true

      # Enable/disable caching. By default caching is disabled.
      # Run rails dev:cache to toggle caching.
      if Rails.root.join('tmp', 'caching-dev.txt').exist?
        config.action_controller.perform_caching = true

        config.cache_store = :memory_store
        config.public_file_server.headers = {
          'Cache-Control' => "public, max-age=#{2.days.to_i}"
        }
      else
        config.action_controller.perform_caching = false

        config.cache_store = :null_store
      end

      # Store uploaded files on the local file system (see config/storage.yml for options)
      config.active_storage.service = :local

      # Don't care if the mailer can't send.
      config.action_mailer.raise_delivery_errors = false

      config.action_mailer.perform_caching = false

      # Print deprecation notices to the Rails logger.
      config.active_support.deprecation = :log

      # Raise an error on page load if there are pending migrations.
      config.active_record.migration_error = :page_load

      # Highlight code that triggered database queries in logs.
      config.active_record.verbose_query_logs = true

      # Debug mode disables concatenation and preprocessing of assets.
      # This option may cause significant delays in view rendering with a large
      # number of complex assets.
      config.assets.debug = false

      # Suppress logger output for asset requests.
      config.assets.quiet = true

      # Raises error for missing translations
      # config.action_view.raise_on_missing_translations = true

      # Use an evented file watcher to asynchronously detect changes in source code,
      # routes, locales, etc. This feature depends on the listen gem.
      config.file_watcher = ActiveSupport::EventedFileUpdateChecker
    end

我已将config.assets.compile设置为false,推送到生产环境并在终端中运行以下命令:

RAILS_ENV=production rake assets:clobber
RAILS_ENV=production rake assets:precompile 

我的图像仍然没有显示,这是终端显示的内容:

/Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core- 
2.1.0/lib/fog/core/service.rb:244:in `validate_options': Missing required 
arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core-2.1.0/lib/fog/core/service.rb:268:in `handle_settings'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core-2.1.0/lib/fog/core/service.rb:98:in `new'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core-2.1.0/lib/fog/core/services_mixin.rb:16:in `new'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core-2.1.0/lib/fog/storage.rb:22:in `new'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/configuration.rb:126:in `eager_load_fog'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/configuration.rb:139:in `fog_credentials='
from /Users/CHAFET/code/godiaz/Hoxton-Technologica/config/initializers/carrierwave.rb:3:in `block in <main>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/configuration.rb:161:in `configure'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/carrierwave-1.2.3/lib/carrierwave.rb:14:in `configure'
from /Users/CHAFET/code/godiaz/Hoxton-Technologica/config/initializers/carrierwave.rb:1:in `<main>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `block in load'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `load'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:657:in `block in load_config_initializer'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/notifications.rb:170:in `instrument'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:656:in `load_config_initializer'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:613:in `each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:613:in `block in <class:Engine>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:50:in `each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:50:in `tsort_each_child'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:415:in `call'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:347:in `each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:347:in `call'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
from /Users/CHAFET/code/godiaz/Hoxton-Technologica/config/environment.rb:5:in `<main>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:102:in `preload'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
/Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core- 
2.1.0/lib/fog/core/service.rb:244:in `validate_options': Missing required 
arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core- 
2.1.0/lib/fog/core/service.rb:268:in `handle_settings'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core- 
2.1.0/lib/fog/core/service.rb:98:in `new'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core-2.1.0/lib/fog/core/services_mixin.rb:16:in `new'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fog-core-2.1.0/lib/fog/storage.rb:22:in `new'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/configuration.rb:126:in `eager_load_fog'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/configuration.rb:139:in `fog_credentials='
from /Users/CHAFET/code/godiaz/Hoxton-Technologica/config/initializers/carrierwave.rb:3:in `block in <main>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/configuration.rb:161:in `configure'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/carrierwave-1.2.3/lib/carrierwave.rb:14:in `configure'
from /Users/CHAFET/code/godiaz/Hoxton-Technologica/config/initializers/carrierwave.rb:1:in `<main>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `block in load'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `load'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:657:in `block in load_config_initializer'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/notifications.rb:170:in `instrument'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:656:in `load_config_initializer'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:613:in `each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/engine.rb:613:in `block in <class:Engine>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:50:in `each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:50:in `tsort_each_child'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:415:in `call'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:347:in `each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:347:in `call'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
from /Users/CHAFET/code/godiaz/Hoxton-Technologica/config/environment.rb:5:in `<main>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:102:in `preload'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/CHAFET/.rbenv/versions/2.4.4/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'

1 个答案:

答案 0 :(得分:1)

将值设置为true将为每个请求编译资产。设置为false时,您需要确保资产已被预编译。

您可以通过在生产模式下启动服务器之前运行以下命令来做到这一点:

RAILS_ENV=production rake assets:clobber
RAILS_ENV=production rake assets:precompile

clobber将从公共目录中删除预编译的资产,precompile将编译该资产并将其存储在公共目录中。

希望这会有所帮助。