为什么React Native App不断要求删除的Main.js



我正在通过编码一个非常简单的聊天应用程序来学习React Native(0.58.5)。components下有一个模块Chat.js。但是,错误不断要求在components下丢失一个名为Main.js的模块。在我启动'反应式运行android . And the error is the same even if I put the main.js back under组件`之前删除模块Main.js。这是错误:

 DELTA  [android, dev] ....../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)::ffff:127.0.0.1 - - [27/Feb/2019:03:12:59 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.12.1"
error: bundling failed: Error: Unable to resolve module `./components/Main` from `C:Dcodejsemps_appApp.js`: The module `./components/Main` could not be found from `C:Dcodejsemps_appApp.js`. Indeed, none of these files exist:
  * `C:Dcodejsemps_appcomponentsMain(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
  * `C:Dcodejsemps_appcomponentsMainindex(.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:Dcodejsemps_appnode_modulesmetrosrcnode-hasteDependencyGraphModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (C:Dcodejsemps_appnode_modulesmetrosrcnode-hasteDependencyGraphResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (C:Dcodejsemps_appnode_modulesmetrosrcnode-hasteDependencyGraph.js:273:16)
    at Object.resolve (C:Dcodejsemps_appnode_modulesmetrosrclibtransformHelpers.js:261:42)
    at dependencies.map.result (C:Dcodejsemps_appnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:391:31)
    at Array.map (<anonymous>)
    at resolveDependencies (C:Dcodejsemps_appnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:388:18)
    at C:Dcodejsemps_appnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:261:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:Dcodejsemps_appnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:87:24)
 DELTA  [android, dev] ....../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.

这是App.js

import React, { Component } from "react";
import Chat from "./components/Chat";
export default class App extends Component {
  render() {
    return <Chat />;
  }
}

上面没有提及Main.jsMain.js是否保留在React Native中?

搜索index.android.bundle并从您的Android文件夹中删除。

杀死Metro Bundler的所有实例。

在您项目的Android文件夹的CMD或PowerShell中运行gradlew clean

击中react-native run-android

相关内容

  • 没有找到相关文章

最新更新