Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
974 views
in Technique[技术] by (71.8m points)

react native - Expo : cannot find a module LogReporter

I have created a React Native Project and I was trying to open that project in Expo XDE. It throws the following error:

Cannot find module ... ode_modulesexpooolsLogReporter

Firstly I created a React Native project by cloning a KitchenSink Project. Link:

NativeBase-KitchenSink

When I started the project by issuing series of commands inside the project root directory:

npm install and then expo start

I saw that the app.json was also not proper, which was the following:

{
  "name": "NativebaseKitchenSink",
  "displayName": "NativebaseKitchenSink"
}

After issuing expo start react-native reported that the app.json is not to be found in the current directory.

[17:05:08] Starting project at D:ProjectsReactNativeProjectsAwesomeProject [17:05:10] Error: Missing app.json. See https://docs.expo.io/ [17:05:10] Couldn't start project. Please fix the errors and restart the project. [17:05:10] Error: Couldn't start project. Please fix the errors and restart the project. at C:[email protected]:1565:11 at Generator.next () at step (C:UsershpAppDataRoaming pm ode_modulesexpo-cli ode_modulesxdluildProject.js:2033:191) at C:UsershpAppDataRoaming pm ode_modulesexpo-cli ode_modulesxdluildProject.js:2033:361 at process._tickCallback (internal/process/next_tick.js:68:7)

I changed app.json to:

{
  "expo": {
    "name": "AwesomeProject",
    "description": "A Kitchen Sink project.",
    "slug": "AwesomeProject",
    "privacy": "public",
    "sdkVersion": "30.0.0",
    "platforms": [
      "ios",
      "android"
    ],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "package": "com.abhsax.first"
    },
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/logo.png",
    "splash": {
      "image": "./assets/splashscreen.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ]
  }
}

There were some updates in the project when I issued npm install again. Then I issued:

expo start

This error came:

(node:2044) UnhandledPromiseRejectionWarning: Error: Cannot find module 'D:ProjectsReactNativeProjectsAwesomeProject ode_modulesexpooolsLogReporter'

Why am I getting this error, and how can I fix it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...