错误:Sprockets :: FileNotFound:找不到Heroku的文件'application.scss'

txi*_*zle 3 assets ruby-on-rails heroku precompile sprockets

我有一些问题,Sprockets在rake资产期间找不到文件:precompile.我之前没有遇到过这个问题,但是当我添加了一个生成的迁移(本地构建)时,Heroku无法构建我的应用程序,我不知道为什么,因为它在本地构建(没有我运行额外的rake资产:预编译).

错误信息是这样的:

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       Sprockets::FileNotFound: could not find file: /tmp/build_dd4a799769e6963b7b292df72db58fd8/username-appname-uniqueid/app/assets/stylesheets/application.scss
Run Code Online (Sandbox Code Playgroud)

有什么帮助吗?感谢您的时间!

PS.作为旁注 - 当我运行"rake assets:precompile"然后推送到Heroku时,应用程序会构建.然而,一个css类"fa-bars"的项目搞砸了......为什么会这样?

谢谢!

小智 8

我在Sprockets 3.3.3和我们的Rails 4.2.3应用程序中添加了相同的问题.

我通过清理我们的dyno构建缓存来修复它:

heroku repo:purge_cache
Run Code Online (Sandbox Code Playgroud)

请注意,您的下一次部署将需要更长时间,因为捆绑缓存也将被清除.

  • 安装 Heroku 存储库插件:`heroku plugins:install https://github.com/heroku/heroku-repo.git` (2认同)