React-Native未构建应用程序,显示未找到模块错误

时间:2018-11-24 19:26:35

标签: react-native

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

App.js代码

  

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

     

const App = createStackNavigation({       登录名:{screen:登录名},       垃圾:{screen:Splash}},{       initialRouteName:“飞溅”,       headerMode:“ none”,});

     

导出默认应用

无法从./components/splash/splash解析模块/home/subrata/puplr_mobile_app/puplr/App.js:从./components/splash/splash找不到模块/home/subrata/puplr_mobile_app/puplr/App.js。实际上,这些文件都不存在:   * /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) 错误:无法从./components/splash/splash解析模块/home/subrata/puplr_mobile_app/puplr/App.js:从./components/splash/splash找不到模块/home/subrata/puplr_mobile_app/puplr/App.js。实际上,这些文件都不存在:   * /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)

1 个答案:

答案 0 :(得分:0)

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

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