When I run the npm install -g expo-cli, the update completes and notes that I’m on version 3.11.1. However, when I run expo-cli -V, I see the previous version that I had–meaning that the update was not actually successful. Is there something I should be doing after updating? What is the best approach at solving this issue?
are you using both npm and yarn? maybe you installed it with yarn before and yarn is first in your path. run which expo to see where the current expo-cli installation is
Thanks for chiming in notbrent–really appreciate it. Primarily, I’m using npm; however, I just installed yarn. I did the following command in terminal “yarn global add install expo-cli”. Seems like the update to the latest version of expo-cli was successful; however, when I do expo-cli -V, I still see the previous version of expo-cli.
here’s a screenshot from after installing the latest version using yarn and then checking which version of expo-cli I have.
After following your instructions, the download seemed to work; however, when I run the command “expo-cli -V”, I still get the version that I had before. Weird that it’s still happening. Here’s the history in the terminal.
Also rm /usr/local/bin/expo-cli and try expo --version
It looks like your packages might be installing to /Users/xxx/.npm-global/... but the bin directory is not in your PATH. (Based on the the above screenshot and the type -a expo output.)
What does echo $PATH give you? You can just post the text here instead of a screenshot.
See if you have a symlink or file called expo in /Users/*/.npm-global/bin.
If so you might want to put that directory in your PATH before /usr/local/bin.
Just did the following command: rm /usr/local/bin/expo-cli however, when I run expo --version I get “-bash: /usr/local/bin/expo: No such file or directory”
You should not have /usr/local in your PATH but it’s also unlikely to cause problems. Also the duplicates are not going to help, but are also not going to hurt.
So that confirms that /Users/*/.npm-global/bin is not in your PATH. I am pretty sure based on the screenshot from your second last message that that is where expo-cli is being installed. Please confirm that.
The -bash: /usr/local/bin/expo: No such file or directory error is because your current bash session still thinks that is where the expo command exists, for two reasons:
It keeps a cache of paths to commands that it has encountered. You can clear this with hash -d expo
The PATH doesn’t contain the location that your npm command has installed the new version, so bash can’t find it.
Hey wodin–thanks again for your continued support. I added the export PATH=~/.npm-global/bin:$PATH to the end of the .profile in my home directory. Here’s a screenshot:
Gotcha, I just saved the export PATH=~/.npm-global/bin:$PATH in .profile. I opened a new terminal window and did echo $PATH. Here’s the output from the new terminal.
Understandably! I went ahead and followed the above instructions. Here’s the output from the terminal. Interestingly, expo --version is finally showing the correct version. I’m going to try to use expo start in the project directory.