How to build task 'assets:precompile'

后端 未结 5 2013
不知归路
不知归路 2020-12-25 11:00

I\'m getting that error on my production server, and can\'t figure out why. It happens when running this command:

bundle exec rake assets:precompile RAILS_EN         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-25 11:58

    I think that it might be because you aren't requiring the asset gems in production. By default rails expects that you are pre-compiling your assets in production. Change this in config/application.rb:

    Comment out this line:

    Bundler.require *Rails.groups(:assets => %w(development test))

    And uncomment this line:

    Bundler.require(:default, :assets, Rails.env)

提交回复
热议问题