无法解析 React Native App 中的模块 [英] Unable to Resolve Module in React Native App

查看:64
本文介绍了无法解析 React Native App 中的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 React Native 中遇到错误,说它无法解析模块.它说某个文件夹不存在,但路径不准确.它告诉我 Directory/Users/user/Desktop/RNApp/app/app/containers 不存在.我不知道第二个应用程序来自路径中的哪里.我的目录是这样的

I'm getting an error in React Native saying it can't resolve a module. It's saying a certain folder doesn't exist but the path isn't accurate. It is telling me that Directory /Users/user/Desktop/RNApp/app/app/containers doesn't exists. I have no idea where that second app is coming from in the path though. My directory looks like this

这就是我在 app/containers/index.js 中导出容器组件的方式

This is how I am exporting my container components in app/containers/index.js

export RNAppNavigator from './Navigator/RNAppNavigator'
export SplashContainer from './Splash/SplashContainer'
export AppContainer from './App/AppContainer'

所以我应该能够像 import {AppContainer} from '~/containers 一样导入它们,对吗?我没有遇到任何其他组件的问题.只是AppContainer.

So I should be able to import them like import {AppContainer} from '~/containers correct? I don't get an issue with any other components. Just the AppContainer.

谢谢!

推荐答案

react-native start --reset-cache 解决了这个问题.https://github.com/facebook/react-native/issues/1924

这篇关于无法解析 React Native App 中的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆