Can't login from expo cli

I just registered my user (danimz) and I can’t login in the command line:

 expo login -u danimz -p ***

fails with the error:

Invalid username/password. Please try again.

but I can login with the same credentials here and in the expo.dev website.

What is the problem?

Just to be sure- I would update expo-cli to the most recent version, although I don’t think anything around authentication has changed recently :thinking:

I’m on the latest version already.

npm list -g expo-cli
C:\Users\Daniele\AppData\Roaming\npm
`-- expo-cli@4.12.1

Maybe I should downgrade?

I downgraded to 4.10.1 and I’m getting the following error:

Uncaught Error Error: EPERM: operation not permitted, rename 'C:\Users\Daniele\.expo\state.json.865095003' -> 'C:\Users\Daniele\.expo\state.json'

While upgrading to 4.12.3 throws again:

Invalid username/password. Please try again.

All of the above was executed on a git bash shell. If I try to run expo login on powershell i get the following error on both 4.12.1 and 4.12.3:

Uncaught Error Error: EPERM: operation not permitted, rename 'C:\Users\Daniele\.expo\state.json.2458755852' -> 'C:\Users\Daniele\.expo\state.json'

Running on a poweshell with admin privileges yields the same error.

If i delete that state.json file before running the command on powershell I get the Invalid username/password error the first time I run it, then EPERM if I try to run it again.

Edit:
I realized I wasn’t on the latest nodejs LTS version. Now I am but the Invalid username/password error persists on both git bash and powershell. I’m not getting the EPERM error anymore.

The EPERM error would be either because you ran an expo command as an admin user and that created files that your normal user doesn’t have access to, or because something else (e.g. antivirus software) has one or more of the files open at the time.

Does it work if you use expo login without specifying the username and password on the command line? It should prompt for them.

Yes! expo login without credentials failed on git bash but succeded on powershell. Thanks for the help!

1 Like

I’m not sure why you might have had problems with git bash, but one thing to bear in mind when you use the -u and -p options on the command line is that you might need to be careful with the quoting.

e.g. if you use cmd.exe (not sure about PowerShell) you should probably use double quotes. In bash you should probably use single quotes. Double quotes might work too, but if you have something like $x somewhere in your password then bash will try to substitute an environment variable called x. If you use single quotes then it will not substitute anything.

If You want to login in expo through terminal in visual studio code, first must to start visual studio code as administrator.