Can not update / uninstall expo-cli

┌─────────────────────────────────────────────────────────────┐
│ │
│ There is a new version of expo-cli available (4.0.17). │
│ You are currently using expo-cli 3.0.2 │
│ Run npm install -g expo-cli to get the latest version │
│ │
└─────────────────────────────────────────────────────────────┘

Expo CLI 3.0.2 environment info:
System:
OS: macOS 10.15.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 15.4.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.0.15 - /usr/local/bin/npm
IDEs:
Xcode: /undefined - /usr/bin/xcodebuild
npmGlobalPackages:
expo-cli: 4.0.17

I can´t update expo-cli to the current version with
npm install -g expo-cli

I tried to uninstall all versions with
npm -g uninstall expo-cli --save && yarn global remove expo-cli
and
cd ~ && rm -rf .expo

but still get the version
$ expo --version
3.0.2

Hi

You might have installed it with yarn as well. Try this:

yarn global remove expo-cli

If that doesn’t fix it, try finding where the 3.0.2 version is:

type -a expo

or

which expo

That might give you a clue what the problem is.

Hi,

thank you for your reply.

Remove with yarn I get an error

yarn global remove expo-cli

yarn global v1.22.10

warning package.json: No license field

warning …/…/…/package.json: No license field

[1/2] :wastebasket: Removing module expo-cli…

error This module isn’t specified in a package.json file.

info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.


type -a expo
expo is /usr/local/bin/expo

What does this give you?

ls -l /usr/local/bin/expo

Also:

npm bin -g
s -l /usr/local/bin/expo
lrwxr-xr-x  1 root  admin  40 22 Jul  2019 /usr/local/bin/expo -> ../lib/node_modules/expo-cli/bin/expo.js

npm bin -g

/Users/alexander/.npm-global/bin

(not in PATH env variable)

OK, so it looks like a previous installation of node/npm installed the expo command to /usr/local/bin/expo and the rest of the package to /usr/local/lib/node_modules/expo-cli. The current version of npm looks like it’s installing the expo command to the .npm-global/bin directory inside your home directory.

I am not sure what would have caused this difference in the installation locations.

Can you run ls -l /Users/alexander/.npm-global/bin/expo to see where the symlink is pointing? I suspect it’s to somewhere in your home directory instead of /usr/local/lib/node_modules/

To get it working, you’ll need to either convince the current npm to install stuff under /usr/local or the safer option: add /Users/alexander/.npm-global/bin to your PATH, but it must come somewhere before /usr/local/bin.

Hi Wodin,

thank you for your support !!

/.npm-global/bin/expo
lrwxr-xr-x  1 alexander  staff  40 28 Dez 12:13 /Users/alexander/.npm-global/bin/expo -> ../lib/node_modules/expo-cli/bin/expo.js

To get it working, you’ll need to either convince the current npm to install stuff under /usr/local or the safer option: add /Users/alexander/.npm-global/bin to your PATH , but it must come somewhere before /usr/local/bin .

Shall I add
export PATH="/Users/alexander/.npm-global/bin:$PATH" ?

BR

Alex

OK, so this shows that the new version of expo-cli is being installed to /Users/alexander/.npm-global/lib/node-modules/expo-cli.

Yes, that should do the trick.

Worked!!
MacBook-Pro-3:~ alexander$ expo --version
4.0.17

Thank you for your great support!

1 Like

Please help me with the same issue.
I ran ls -l /usr/local/bin/expo
lrwxr-xr-x 1 bilalhaidermakki admin 40 Dec 24 19:42 /usr/local/bin/expo -> …/lib/node_modules/expo-cli/bin/expo.js

ran npm bin -g
/usr/local/Cellar/node/15.5.1/bin
(not in PATH env variable)

Will export PATH="/usr/local/Cellar/node/15.5.1/bin:$PATH" fix my issue also?