android - React Native App - 开发服务器返回响应错误代码:500
问题描述
我再问一次,因为我的案子没有根据以前的答案解决。我创建了一个在 Snack 上完美运行的 React Native App,但后来我想在 Expo 上尝试一下(我想添加一些 Snack 无法加载的模块)。所以,我曾经create-react-native-app
制作我的项目。然后,在编辑代码后,我尝试使用 Genymotion 模拟器启动它,但每次我这样做时,都会出现以下错误:
我无法理解它有什么问题?我已经尝试删除 node_modules 文件夹,更改 React Native 和 Babel 版本并使用npm install
. 此外,在控制台中,它向我显示了这个错误:
22:33:56: Unable to resolve ./components/AssetExample" from "./C:\\Users\\danie\\HC\\App.js`: The module `./components/AssetExample` could not be found"
22:33:56: Failed building JavaScript bundle
但我不知道这个模块应该在哪里导入?package.json 还是 package-lock.json?
我使用以下命令在 Genymotion 中启动它:
cd HC
npm start android
我能做些什么?请帮我。
React Native 版本:0.55.2
Babel(预设 React Native) 版本:^4.0.0
编辑:项目结构和代码按要求,我在 GitHub 上创建了存储库:https ://github.com/DanielVip3/HC ^ 我没有推送 node_modules 文件夹,因为它太大了,但我想你已经知道了:它包含 React Native 使用的所有模块。
解决方案
请给我们您的项目结构和 App.js 文件中的代码(同时确保您在 AssetExample.js 文件中导出 AssetExample 类。 我了解您正在尝试做的是(可能)在 App.js 中您从“./components/AssetExample”导入 AssetExample,因此可能的错误是: 1)路径错误 2)您没有在 AssetExample.js 中导出默认 AssetExample
推荐阅读
- pandas - Pandas 系列索引数据类型
- azure-ad-b2c - AADB2C90289:我们在连接到身份提供者时遇到错误。请稍后再试
- doxygen - 在 Doxygen 中指定图像大小?
- javascript - 如何访问我的 javascipt 文件中切换开关的文本?
- ansible - 如果在第一台主机上执行任务,如何获取第二台主机的“ansible_port”?
- javascript - 使用 jquery 创建模板,但 DOM 未更新
- javascript - 在模拟的窗口导航器对象上操作时出现未定义的错误
- apache2 - http和https之间的Apache2多主机区别
- reporting-services - SSRS 根据条件逻辑更改部分表达式的颜色
- django - Django Rest Framework - 在另一个序列化程序中处理序列化程序的结果