Expo : cannot find a module LogReporter

送分小仙女□ 提交于 2019-11-27 21:24:55

check your package.json if it contains all needed dependencies and run npm install in the home directory of the project

if a package is missing you can add it with

npm install <package_name> --save

if you are using yarn run:

yarn add expo

I did:

yarn add expo

and it worked for me =)

See docs:

introducing-button-yarn-and-a-public-roadmap

and

npm-vs-yarn-in-react-native

These documents say that since the project configured using Yarn, you have to follow Yarn way. [Note: There is a file yarn.lock inside the root directory of the project, you have posted]

Therefore such projects are dealt by following the instructions in the documentation.

Please see How do I create a React Native project using Yarn? to actually create a react-native project using Yarn.

And please be sure to remove node_modules folder and issue command npm install before adding react native CLI using yarn. You have to remove package-lock.json from your project root. This will be to prevent mixing different package managers : npm and yarn.

Instead, it will be a good idea not to use npm, and in order to generate node_modules, just issue command:

yarn

Last link recommends to install every package you need using yarn, and not to use any other package manager:

yarn global add react-native-cli

to add react-native:

yarn add react-native

to add missing packages:

yarn add react-base --save

and to install expo using yarn:

yarn add expo

install expo-cli

yarn add expo-cli

It is possible that you can do without Expo. Just focus on react-native and yarn.

Generate android and ios folders:

react-native eject

Start yarn:

yarn start

run build of your choice, and make sure the SDKs are installed.

react-native run-android

Please also see: Uncaught TypeError: Cannot read property 'forEach' of undefined, on a KitchenSink demo

Happy Coding :-)

Drenniud Branchett

Install the Expo modules

npm install --save

i.e.

npm install expo --save

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!