Unlike the web, React Native is not backwards compatible. This means that npm packages often need to be the exact right version for the currently installed copy of react-native in your project. Expo CLI provides a best-effort tool for doing this using a list of popular packages and the known working version combinations. Simply use the install command as a drop-in replacement for npm install:
npx expo install expo-camera Visit here to see more: https://docs.expo.dev/more/expo-cli/
Answer from Simranjeet on Stack OverflowVideos
I'm building my app using Expo and whenever I can, I use "expo install some-package". It seems to work most of the time, but something it doesn't and my only option seems to be to fall back to using npm install.
I realize that expo install is safer because it "knows" compatibility, but so far I've had to use npm because of failures with expo install (often peer dependency version conflicts). For 2-3 packages I've done this with, they all worked fine.
Is there any major risk I'm running by not using expo install for a couple packages? I'm I setting myself up for pain?
» npm install expo
I created a Blank Typescript template and ran `npx expo start --tunnel`, selected the development server from my Expo app on my phone. No issues. However, after running `npm install expo-dev-client` and starting the server again I could no longer open the server from my phone
Any ideas what went wrong? This used to be fine a few days ago
» npm install install-expo-modules
Today I tried to update my expo-cli and got the same error. So I installed an older version again. You can try this, it worked for me.
npm i -g [email protected]
EDIT:
Now there is a bug report at Expo-CLI Github page & someone suggested to run npm install --global --production windows-build-tools and then install the latest version of Expo. This npm package installs Visual C++ Build Tools and Python 2.7. If you want the latest version of Expo, you can try this.
Seems like there could be quite a few issues here and I don't think a simple answer would suffice..
would need to know what environment that you are running your command from
That being said, you could use advice from this GitHub issue thread and simple try and use npx
npx expo init {my-project}
https://github.com/expo/expo-cli/issues/590
although this solution is not the best and the safest solution exists, this worked for me and that make sense because all the problem we had with the errors is the permission problems. so you can use this command and ignore those permission problems :
sudo npm install expo-cli -g --unsafe-perm
I was having the same problem with npm install -g expo-cli, having "MODULE_NOT_FOUND",
I installed yarm with brew, just in case you do not already have it:
brew install yarn
and then use:
yarn global add expo-cli
to create a project you can:
expo init nameOfTheNewProject
and choose a template in the console. Finally run the project with
yarn start
Let me know if it works for you!