【问题标题】:React-Native not building application, showing module not found errorReact-Native 未构建应用程序,显示未找到模块错误
【发布时间】:2019-04-26 22:46:42
【问题描述】:

当我尝试运行 react-native run-android 时出现此错误。

App.js 代码

import React, {Component} from 'react';导入{平台,样式表, 来自'react-native'的文本,视图};导入 { createStackNavigation } 从 '反应导航';从'./components/splash/splash'导入Splash; 从'./components/login/login'导入登录;

const App = createStackNavigation({ 登录:{屏幕:登录}, 飞溅:{屏幕:飞溅}},{ initialRouteName: "飞溅", headerMode: "none", });

导出默认应用

无法从/home/subrata/puplr_mobile_app/puplr/App.js 解析模块./components/splash/splash:无法从/home/subrata/puplr_mobile_app/puplr/App.js 找到模块./components/splash/splash。事实上,这些文件都不存在: * /home/subrata/puplr_mobile_app/puplr/components/splash/splash(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx) * /home/subrata/puplr_mobile_app/puplr/components/splash/splash/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx) 错误:无法从/home/subrata/puplr_mobile_app/puplr/App.js 解析模块./components/splash/splash:无法从/home/subrata/puplr_mobile_app/puplr/App.js 找到模块./components/splash/splash。实际上,这些文件都不存在: * /home/subrata/puplr_mobile_app/puplr/components/splash/splash(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx) * /home/subrata/puplr_mobile_app/puplr/components/splash/splash/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx) 在 ModuleResolver.resolveDependency (/home/subrata/puplr_mobile_app/puplr/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:120:15) 在 ResolutionRequest.resolveDependency (/home/subrata/puplr_mobile_app/puplr/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:49:18) 在 DependencyGraph.resolveDependency (/home/subrata/puplr_mobile_app/puplr/node_modules/metro/src/node-haste/DependencyGraph.js:218:16) 在 Object.resolve (/home/subrata/puplr_mobile_app/puplr/node_modules/metro/src/lib/transformHelpers.js:141:30) 在dependencies.map.result (/home/subrata/puplr_mobile_app/puplr/node_modules/metro/src/DeltaBundler/traverseDependencies.js:373:31) 在 Array.map() 在 resolveDependencies (/home/subrata/puplr_mobile_app/puplr/node_modules/metro/src/DeltaBundler/traverseDependencies.js:369:18) 在/home/subrata/puplr_mobile_app/puplr/node_modules/metro/src/DeltaBundler/traverseDependencies.js:188:33 在 Generator.next () 在步骤(/home/subrata/puplr_mobile_app/puplr/node_modules/metro/src/DeltaBundler/traverseDependencies.js:298:30)

【问题讨论】:

    标签: react-native


    【解决方案1】:

    有时您可能需要重新启动 Metro 捆绑器才能找到新创建的文件。

    如果这不是您的问题,您必须确保您的 /home/subrata/puplr_mobile_app/puplr/components/splash 文件夹中有一个 splash.js 文件。

    【讨论】:

      猜你喜欢
      • 2017-05-22
      • 2019-08-10
      • 1970-01-01
      • 1970-01-01
      • 2022-01-02
      • 2018-08-05
      • 2022-11-01
      • 1970-01-01
      • 2021-05-16
      相关资源
      最近更新 更多