Solution to zsh: command not found: expo on macOS Catalina

So I recently upgraded to macOS Catalina and all hell broke loose. Many of my command line utilities kept working but I have definitely wasted close to 30 hours trying to fix everything to make it work just like it did in the previous macOS version.

Recently, I am started working on a demo for my talk at the Wordcamp Islamabad and wanted to try the latest tools for building a react native app. So naturally, I wanted to try expo CLI as it gives all the tools needed to work with react native on number of platforms i.e web, iOS and Android.

I installed the expo CLI using the following command:

npm install -g expo-cli

But when I tried to run expo, it gave me this error

zsh: command not found:

Have rarely worked with zsh and not having any command over it, I tried many ways to fix it, including the path of the npm root which I got via:

npm root

Apparently, it’s not a reliable way to do it. So I ended up adding

export PATH="$HOME/.npm-packages/bin:$PATH

to my ~/.zshrc file. Which solved the problem for good.

Now I can run expo cli with no problem.

Hope this helps others who are stuck like me!

Leave a Reply

Your email address will not be published. Required fields are marked *