最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Expo Cannot Find Module after reinstall - Stack Overflow

programmeradmin1浏览0评论

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

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

Share Improve this question edited Jun 24, 2019 at 22:12 Charles Pettis asked Jun 24, 2019 at 22:04 Charles PettisCharles Pettis 3571 gold badge3 silver badges13 bronze badges 3
  • Delete node_modules and package-lock.json, run npm install again. – Lawrence Cherone Commented Jun 24, 2019 at 22:09
  • I tried that, no luck. Uninstalling and reinstalling with npm and yarn doesn't work either – Charles Pettis Commented Jun 25, 2019 at 0:43
  • Is this the sequence of execution you've executed? expo init youproject => cd youproject => expo start – hong developer Commented Jun 25, 2019 at 9:12
Add a comment  | 

4 Answers 4

Reset to default 7

Try running

npm install -g expo-cli --force

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)

  1. "node_modules" folder copy/paste from C:\Users\charl.npm-global to C:\Users\charl\AppData\Roaming\npm\
  2. npm i

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

发布评论

评论列表(0)

  1. 暂无评论