'Expo Cannot Find Module after reinstall
I'm having issues getting expo to start. It tries to open dev tools and dev tools will not open and gives me this error:
Cannot find module 'C:\Users\charl\AppData\Roaming\npm\node_modules\expo-
cli\node_modules\@expo\image-utils\build\index.js'. Please verify that the
package.json has a valid "main" entry
Error: Cannot find module
'C:\Users\charl\AppData\Roaming\npm\node_modules\expo-
cli\node_modules\@expo\image-utils\build\index.js'. Please verify that the
package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:227:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:364:18)
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:597:27)
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (C:\@expo\[email protected]\src\AssetUtils.js:6:1)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
This is for a react-native application, using NPM, Node, a Windows 10 machine.
I've tried reinstalling expo with npm and yarn, but i cant get it to work. I looked and saw in the package.json file the 'main' key has a value of 'node_modules/expo/AppEntry.js'. Before this happened i was having trouble with expo that it told me that expo cant be recognized so i messed around with environment variables until it worked. Now this. Thank you guys for any help
Solution 1:[1]
Try running
npm install -g expo-cli --force
Solution 2:[2]
Was having this same issue when using Windows Powershell or CMD.exe. Was able to get passed it by using Git Bash. Try running npm install -g expo-cli
from a MINGW64 terminal (ex: Git Bash)
Solution 3:[3]
- "node_modules" folder copy/paste from C:\Users\charl.npm-global to C:\Users\charl\AppData\Roaming\npm\
- npm i
Solution 4:[4]
I had the same problem. I sort out using two step
first download the Git Bash and installed it , once it was installed open as administrator and wrote the code
npm install -g expo-cli --force
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Abhishek Gurjar |
Solution 2 | Hams Ahmed Ansari |
Solution 3 | Ravshan |
Solution 4 | Sachith Muhandiram |