1

呃,我遇到了和这里一样的错误...... rails assets:precompile during slug for s3 error: Fog provider and directory can't be blank when env set on the solution is not working...

当我尝试预编译资产时,出现以下错误:

$ RAILS_ENV=production bundle exec rake assets:precompile
/Users/me/.rvm/rubies/ruby-1.9.3-p362/bin/ruby /Users/me/.rvm/gems/ruby-1.9.3-p362@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
AssetSync: using default configuration from built-in initializer
AssetSync: using default configuration from built-in initializer
rake aborted!
Fog provider can't be blank
/Users/me/.rvm/gems/ruby-1.9.3-p362/gems/asset_sync-0.5.4/lib/asset_sync/asset_sync.rb:32:in `sync'
/Users/me/.rvm/gems/ruby-1.9.3-p362/gems/asset_sync-0.5.4/lib/tasks/asset_sync.rake:3:in `block in

当我输入 heroku labs:list ... 时,它显示 user-env-compile 已启用

[+] user-env-compile       Add user config vars to the environment during slug compilation

当我输入 heroku config...我可以看到雾变量已设置

AWS_ACCESS_KEY_ID:            myid
AWS_SECRET_ACCESS_KEY:        mykey
FOG_DIRECTORY:                mydirectory
FOG_PROVIDER:                 AWS

为什么它会预编译一些文件,然后给出错误?

4

1 回答 1

4

你在本地机器上运行这个?您无法从本地计算机访问 Heroku 的环境变量。

您应该将变量添加到您的 bash_profile,或者尝试类似direnv的方法。如果您使用pow进行开发,最好的选择是.powenv

export AWS_ACCESS_KEY_ID="myid"
export AWS_SECRET_ACCESS_KEY="mykey"
export FOG_DIRECTORY="mydirectory"
export FOG_PROVIDER="AWS"
于 2013-08-30T23:05:52.817 回答