Expo Cannot Find Module after reinstall

11,257

Solution 1

Try running

npm install -g expo-cli --force

Solution 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)

Share:
11,257

Related videos on Youtube

Charles Pettis
Author by

Charles Pettis

Updated on June 04, 2022

Comments

  • Charles Pettis
    Charles Pettis almost 2 years

    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

    • Lawrence Cherone
      Lawrence Cherone almost 5 years
      Delete node_modules and package-lock.json, run npm install again.
    • Charles Pettis
      Charles Pettis almost 5 years
      I tried that, no luck. Uninstalling and reinstalling with npm and yarn doesn't work either
    • hong developer
      hong developer almost 5 years
      Is this the sequence of execution you've executed? expo init youproject => cd youproject => expo start