2017-09-02 63 views
0

当我配置我的应用程序文件,我把我的插件文件夹下的资产,并在我的config/application.rb中的文件添加以下行:Rails的资产插件文件夹不被部署阅读

require_relative 'boot' 

require 'rails/all' 

# Require the gems listed in Gemfile, including any gems 
# you've limited to :test, :development, or :production. 
Bundler.require(*Rails.groups) 

module Cnd 
    class Application < Rails::Application 
    # Initialize configuration defaults for originally generated Rails version. 
    config.load_defaults 5.1 
    config.assets.paths << Rails.root.join("app", "assets", "fonts") 
    config.assets.paths << Rails.root.join("app", "assets", "images") 
    config.assets.paths << Rails.root.join("app", "assets", "bootstrap") 
    config.assets.paths << Rails.root.join("app", "assets", "rs-plugin-5") 
    config.assets.paths << Rails.root.join("app", "assets", "magnific-popup") 
    config.assets.paths << Rails.root.join("app", "assets", "owlcarousel2") 
    config.assets.paths << Rails.root.join("app", "assets", "morphext") 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # -- all .rb files in that directory are automatically loaded. 
    end 
end 

一切都正常运行在我的本地当我部署到Amazon EC2的我收到以下错误:

error message

我不明白为什么它在本地加载的文件,但是当我部署它不是。我现在只是在开发环境中部署。不知道这是否有所作为,但我正在本地生产环境中工作,因此我预编译了资产。我在开发中部署的原因是因为我只需要快速向客户展示进度。

+0

你有预编译生产资产吗?在生产服务器中使用此命令RAILS_ENV =生产捆绑包exec rake资产:预编译 – widjajayd

+0

我做了预编译 –

回答

0

经过一番努力,我找到了答案。我不得不使用这一行RAILS_ENV=production bundle exec rake assets:clobber摆脱预编译,然后一切恢复正常。现在,当我准备好生产时,我需要弄清楚如何预编译包括插件在内的所有资产。