» npm install expo-cli
I need to install Expo but I already have React Native CLI setup on Mac I need to do working with both projects
ios - How to install expo CLI on macbook pro big sur? - Stack Overflow
node.js - How do I properly install expo-cli with yarn? - Stack Overflow
How to use yarn as default when using the npx command?
How do I update Expo CLI to the latest version?
Can I use Expo CLI for existing React Native projects?
Is Expo CLI suitable for building production-ready apps?
Videos
I need to install Expo but I already have React Native CLI setup on Mac I need to do work with both projects
This is a common issue when using a globally-installed npm. The npm docs contain a page about it.
They recommend reinstalling node/npm with a version manager (like nvm). This is often a very good option if you are developing something locally. If you do that, this problem will go away. You can stop reading this answer if you want.
They also provide a way to configure npm to put the globally installed items in a directory of your choosing. That is a good option too, if a version manager won't work for you for whatever reason.
Another option they mention is using npx instead of globally installing the tool. I use this one a lot and like it quite a bit, but it does mean that you frequently have to remember to prefix commands you see with npx.
There are two somewhat common options that they do not list. One is to run your install with sudo. This means that any lifecycle scripts will get run as root on your machine. This is generally a bad idea (which is why they don't mention it in the docs), but is very common.
Another option is to chmod your /usr/local/lib/node_modules directory such that you can write to it. This is also a not-great idea in my opinion (which is probably why it too is not mentioned in the docs), but people do it.
In the case of expo-cli and in most developing-something-locally cases, installing with a package manager like nvm is probably the way to go.
try this:
sudo npm install -g expo-cli
For Yarn:
If you want to save expo-cli package globally then try
yarn global add expo-cli
and if you want expo-cli to be available in the folder in which you are currently working then use
yarn add expo-cli
For npm:
npm install expo-cli --global
or
npm install expo-cli
There's a similar issue reported here. You can try adding expo to your local project to see if that helps.
Try:
yarn add expo