由于DOTENV未初始化的常量错误,无法推送到Heroku [英] Can't push to Heroku because of DOTENV uninitialized constant error

查看:134
本文介绍了由于DOTENV未初始化的常量错误,无法推送到Heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图把我的项目推到Heroku。我一直在使用:

  gem'dotenv-rails',:groups => [:development,:test] 

因为我使用recpatcha并需要将我的密钥导出到应用程序在开发中。



当我尝试将代码推送到heroku时,我注意到这个错误消息:

  remote:! NameError:未初始化的常量Dotenv 

所以我在应用程序中注释了Dotenv gem和任何Dotenv变量。我跑了

  $ bundle exec rake -P 

然后再次尝试推送。我仍然从Heroku得到同样的错误。我需要重置我的gemfiles吗?

解决方案

好的,最后的答案是我需要更改

p>

  gem'dotenv-rails',:groups => [:development,:test] 

to

  gem'dotenv-rails',:require => 'dotenv / rails-now'

我认为这是另一种做法, ABPrime。非常感谢您的帮助。


I am trying to push my project up to Heroku. I have been using:

    gem 'dotenv-rails', :groups => [:development, :test]

Because I am using recpatcha and need to export my keys to the app in development.

When I try to push the code to heroku I noticed this error message:

    remote:  !     NameError: uninitialized constant Dotenv

So I commented out the Dotenv gem and any Dotenv variables in the app. I ran

    $ bundle exec rake -P

Then tried the push again. I am still getting the same error from Heroku. Do I need to reset my gemfiles somehow?

解决方案

Ok, so the answer in the end was that I needed to change

    gem 'dotenv-rails', :groups => [:development, :test]

to

    gem 'dotenv-rails', :require => 'dotenv/rails-now'

which I think is another way of doing what you were suggesting there @ABPrime. Thanks a lot for your help.

这篇关于由于DOTENV未初始化的常量错误,无法推送到Heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆