ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
and using the production group of your Gemfile.
This may be intentional, if you expected rake tasks to be run
cancel the build (CTRL+C) and fix the error then commit the fix:
rake aborted!
我没有任何想要自动运行的rake任务。我应该忽略这个警告吗?
发布于 2014-01-31 22:09:33
您还可以尝试启用user-env-compile
heroku labs:enable user-env-compile
发布于 2013-12-07 01:52:11
我昨天突然收到了这个奇怪的错误。Heroku确认做了一个update到Ruby构建包...
这跟Rakefile有关。你的Rakefile需要什么文件吗?它需要你的应用程序文件吗?如果是这样,则应用程序在加载时不应在未设置任何配置变量的情况下引发异常。
这是违反直觉的,因为应用程序在没有配置变量设置的情况下永远不会运行。
在我的例子中,Sinatra应用程序在init文件中查找数据库urls:
uri = URI.parse( ENV[ "REDISTOGO_URL" ])
如果没有设置env变量,这将引发异常。
您可能会遇到与其他数据库URL相同的问题,例如Mongo或Postgres。
因此,防止缺少env变量:
if ENV[ "REDISTOGO_URL" ]
uri = URI.parse( ENV[ "REDISTOGO_URL" ])
...
在推送到Heroku之前,你可以通过运行bundle exec rake -P
来检查它是否可以工作
此外,请确保在更新init后所有测试都通过。通过重新启动Spork或类似程序来删除任何缓存的init状态。
发布于 2016-08-27 00:47:08
顺便说一句,我也遇到了这个问题。
事实证明,当在production.rb
中有一个rake任务引用config.assets.css_compressor = :sass
时,我把它注释掉了。
非常简单的疏忽,但这会导致rake assets:precompile
失败,从而导致此错误。
https://stackoverflow.com/questions/20422629
复制相似问题