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!
Update: This has been fixed in expo version 31.0.6. Please upgrade the version of expo in your package.json, run npm install and try again.
This is a bug in the version 31.0.5 (and older) of the expo package on Windows and it will be fixed in the next release. In the meantime you can work around it by either starting the project by running expo start (instead of npm start) or by changing the start script inside package.json from expo start to expo-cli start. Sorry for the trouble!
Configure npm to use the new directory path:
npm config set prefix ‘~/.npm-global
In your preferred text editor, open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
now install using npm install … or if you already have node_module go for expo start
» npm install expo-cli
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
You have to try two methods:
- First is to use the command with sudo npm install expo-cli (if you have not used sudo)
- the Second is to delete node_modules and install run again npm install
Maybe it will work
- Open terminal and type
cd /usr/local/lib/node_modules - Then delete the old expo version:
rm -rf .expo-cli-dKBr48UN - Now update the expo package:
sudo npm install -g expo-cli