gpt4 book ai didi

react-native - 为什么 Metro Bundler 声称 app.json 不存在?

转载 作者:行者123 更新时间:2023-12-05 04:52:53 27 4
gpt4 key购买 nike

请注意,这与此处发布的有关缺少模块的其他问题不同。无论我在我的应用程序文件夹中运行 npx react-native run-android 还是 npx react-native start ,它似乎都声称我的 app.json 文件丢失了,但是它在基本目录中。

    error: Error: Unable to resolve module `./app.json` from `index.js`:
None of these files exist:
* app.json
* app.json\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
at ModuleResolver.resolveDependency (C:\rn\MyApp\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:163:15)
at ResolutionRequest.resolveDependency (C:\rn\MyApp\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (C:\rn\MyApp\node_modules\metro\src\node-haste\DependencyGraph.js:287:16)
at Object.resolve (C:\rn\MyApp\node_modules\metro\src\lib\transformHelpers.js:267:42)
at C:\rn\MyApp\node_modules\metro\src\DeltaBundler\traverseDependencies.js:434:31
at Array.map (<anonymous>)
at resolveDependencies (C:\rn\MyApp\node_modules\metro\src\DeltaBundler\traverseDependencies.js:431:18)
at C:\rn\MyApp\node_modules\metro\src\DeltaBundler\traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (C:\rn\MyApp\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)

Base directory

索引.js

/**
* @format
*/

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

最佳答案

在尝试以几乎所有方式清除缓存后,我们遇到了类似的问题,重启机器为我们解决了这个问题。

关于react-native - 为什么 Metro Bundler 声称 app.json 不存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66353217/

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