Heroku CLI authentication issue

依然范特西╮ 提交于 2020-08-02 04:56:25

问题


After a fresh install of Heroku on Windows 7, I can't seem to authenticate from the command-line.

Running the command: heroku login prompts me to enter my credentials. After doing so, I received an error:

heroku: Enter your login credentials
Email: my_email
Password: ************
Error: ENOENT: no such file or directory, open 'z:/_netrc'

I am using PowerShell, and when I run the command cat z:/_netrc, I get this error:

cat : Cannot find drive. A drive with the name 'z' does not exist.

Z: is a network drive, and it is accessible from the file explorer.

I already have a .netrc file in my %HOME% path, but it does not contain the heroku login credentials.

Looking at the official documentation and CLI help, I couldn't find anything useful to fix this. How can I login to my heroku account?

> heroku version
heroku/7.16.6 win32-x64 node-v10.11.0

回答1:


So, the issue is arising from not finding _netrc file on your local computer that is required to complete login with Heroku. I have decided to create the file into following location of my windows 10 computer:

cmd>set HomeDrive=C:/Users/your Windows username/AppData/Local/heroku

In my case,

cmd>set HomeDrive=C:/Users/CrazyMoby/AppData/Local/heroku 

Finally I ran heroku login

The above step resolved heroku login issue in my case.




回答2:


Use setx HOME <netrc_default_location>

where <netrc_default_location> can be:

  • <%NETRC%>\_netrc
  • <%HOME%>\_netrc
  • <%HOMEDRIVE%%HOMEPATH%>\_netrc
  • <%USERPROFILE%>\_netrc

Some clarification can be found here and here.

Probably it's your user <%USERPROFILE%>.

But if you don't need it, just remove _netrc file, reboot and log in again.




回答3:


Run the following command in powershell and the problem should be solved.

$Env:HOMEDRIVE = "C:"

If you need more information, check out the docs on windows environment variables.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7




回答4:


This way work for me. Write in PowerShell next code , where "paulob" need change to your user, because folser "_netrc" exist in:

$Env:HOMEDRIVE = "C:\Users\paulob\"


来源:https://stackoverflow.com/questions/52744433/heroku-cli-authentication-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!