2017-09-02 64 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擺脫預編譯,然後一切恢復正常。現在,當我準備好生產時,我需要弄清楚如何預編譯包括插件在內的所有資產。