Expo: 无法找到模块 LogReporter
Expo: 无法找到模块 LogReporter
我创建了一个React Native项目,然后尝试在Expo XDE中打开该项目。但是出现了以下错误:
无法找到模块...\node_modules\expo\tools\LogReporter
首先,我通过克隆一个KitchenSink项目来创建了一个React Native项目。
链接:
当我在项目根目录下输入一系列命令来启动项目:
npm install
,然后expo start
我发现app.json也不正确,内容如下:
{
"name": "NativebaseKitchenSink",
"displayName": "NativebaseKitchenSink"
}
在输入expo start
后,react-native报告说在当前目录找不到app.json
。
[17:05:08] Starting project at
D:\Projects\ReactNativeProjects\AwesomeProject [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:\xdl@51.4.0\src\Project.js:1565:11
at Generator.next ()
at step (C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:191)
at C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:361
at process._tickCallback (internal/process/next_tick.js:68:7)
我将app.json修改为:
{
"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": [
"**/*"
]
}
}
再次运行npm install
后,项目有一些更新。然后我输入:
expo start
出现了以下错误:
(node:2044) UnhandledPromiseRejectionWarning: Error: Cannot find
module
'D:\Projects\ReactNativeProjects\AwesomeProject\node_modules\expo\tools\LogReporter'
为什么会出现这个错误,我该如何修复?