Rails javascript asset missing after precompile

后端 未结 2 1699
北荒
北荒 2020-12-06 12:08

the Rails Guides says:

If there are missing precompiled files in production you will get an Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPre

相关标签:
2条回答
  • 2020-12-06 12:31

    Try just:

    rake assets:precompile
    

    I've had similar issues and that has worked. You can also delete the contents of the /public/assets directory and try running it again.

    0 讨论(0)
  • 2020-12-06 12:32

    Actually two things needed to do:

    config.assets.precompile += %w( *.js *.css )
    

    as described here, and

    config.serve_static_assets = true
    

    for local production testing when using

    rail s
    

    of course using

    rake assets:precompile
    

    however in my case - without config.assets.precompile this would have no effect since the manifest didn't contain any reference to my javascript file.

    HTH.

    0 讨论(0)
提交回复
热议问题