Cannot update expo-cli to 5.4.6

If I run expo --version it tells me 5.4.4

If I run npm -g install expo-cli

The version stays at 5.4.4

I believe the latest version is 5.4.6

Hi @joshua-revolution

You must have another expo command installed in a directory that is earlier in your PATH.

This can happen e.g. if you also installed expo-cli with yarn, or if you have a second installation of node on your machine.

Check if there are other versions of the expo command somewhere in your PATH:

$ type -a expo

This should show you all the copies of the expo command in your PATH. Ideally there’ll only be one. In your case, there might be one or more, but it seems the first one is version 5.4.4. If there’s more than one then one of the later ones is likely version 5.4.6.

Ideally you’d uninstall the older one. If your 5.4.6 version is no in your PATH, you’ll need to add npm's bin directory to your PATH.

Check if it’s installed globally with yarn:

$ yarn global list expo-cli

Ideally that will either give you an error because yarn is not installed, or it will say something similar to this, indicating that expo-cli is not installed globally with yarn:

yarn global v1.22.18
Done in 0.07s.

If instead you get output like the following, then run yarn global remove expo-cli:

yarn global v1.22.18
info "expo-cli@5.4.4" has binaries:
   - expo
   - expo-cli
Done in 0.57s.

Verify that version 5.4.6 is indeed installed:

$ npm list -g expo-cli

The output depends on where/how you have node installed, but might look something like this:

/home/michael/.npm-global/lib
└── expo-cli@5.4.6

Find where npm's bin directory is

$ npm bin -g

On my machine this outputs:

/home/michael/.npm-global/bin

And if I check, I do have an expo command there, and if I run it, I get the expected version number:

$ /home/michael/.npm-global/bin/expo --version
5.4.6

If I check my PATH I see that the above directory is in there.

Thanks for your reply. Here is the output after running those commands:

jaugustinus@MACBOOK1 ~ % type -a expo
expo is /Users/jaugustinus/.nvm/versions/node/v16.15.0/bin/expo
expo is /opt/homebrew/bin/expo
jaugustinus@MACBOOK1 ~ % yarn global list expo-cli
yarn global v1.22.18
✨  Done in 0.01s.
jaugustinus@MACBOOK1 ~ % npm list -g expo-cli
/opt/homebrew/lib
└── expo-cli@5.4.6

jaugustinus@MACBOOK1 ~ % npm bin -g
/opt/homebrew/bin
jaugustinus@MACBOOK1 ~ %

Seems like I have two expos but not sure how to get rid of the first one.

OK, so you seem to have nodejs installed using nvm. I have not used nvm before, although I know it’s quite popular.

I suspect you have two npm installations too, but somehow the npm command that is associated with that nvm installation of nodejs is either not in your PATH or else it is later in the PATH (the latter seems unlikely).

The best solution would be for you to figure out how to uninstall the version of expo-cli from /Users/jaugustinus/.nvm/versions/node/v16.15.0. If you can’t do this using the npm command from that location, I believe you can do it manually like this:

$ rm -r /opt/homebrew/lib/node_modules/expo-cli
$ rm /opt/homebrew/bin/expo

Otherwise, you could change your PATH to put /opt/homebrew/bin before /Users/jaugustinus/.nvm/versions/node/v16.15.0/bin.

I managed to get rid of it in the nvm folder by uninstalling and reinstalling i.e.

nvm uninstall 16.15.0
nvm install 16.15.0
1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.