Heroku CLI authentication issue
Asked Answered
A

5

6

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
Absorption answered 10/10, 2018 at 16:3 Comment(0)
P
8

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.

Platina answered 12/5, 2020 at 20:52 Comment(0)
I
0

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.

Imperishable answered 10/10, 2018 at 19:27 Comment(0)
E
0

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://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7

Eerie answered 29/2, 2020 at 1:56 Comment(0)
T
0

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\"
Tamatamable answered 25/7, 2020 at 19:54 Comment(0)
F
0

Try running it from GIT BASH cmd instead of PowerShell if you can, I had the same problem and it worked in my case.

Fefeal answered 9/11, 2020 at 17:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.