gpt4 book ai didi

react-native - 世博会 : cannot find a module LogReporter

转载 作者:行者123 更新时间:2023-12-03 21:20:43 29 4
gpt4 key购买 nike

我创建了一个 React Native 项目,我试图在 Expo XDE 中打开该项目。它引发以下错误:

Cannot find module ...\node_modules\expo\tools\LogReporter



首先,我通过克隆 KitchenSink 项目创建了一个 React Native 项目。
关联:

NativeBase-KitchenSink

当我通过在项目根目录中发出一系列命令来启动项目时:
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'



为什么我会收到此错误,我该如何解决?

最佳答案

检查您的 package.json如果它包含所有需要的依赖项并运行 npm install在项目的主目录中

如果缺少包,您可以添加它

npm install <package_name> --save

如果您正在使用 yarn 跑:
yarn add expo

关于react-native - 世博会 : cannot find a module LogReporter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49151286/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com