gpt4 book ai didi

reactjs - react native 问题 : Module does not exist in the Haste module map

转载 作者:行者123 更新时间:2023-12-04 11:41:47 29 4
gpt4 key购买 nike

我创建了一个本地模块并创建了另一个项目来在本地测试它。

这是我的步骤:
cd <Testing project>
npm install ../<Module project>
react-native link <module name>
react-native run-android

然后我收到以下错误:

 error: bundling failed: Error: Unable to resolve module `react-native-helloworld` from `G:\Test\App.js`: Module `react-native-helloworld` does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.

enter image description here

我已经在 StackOverflow 上搜索过这个问题,但没有可行的解决方案。建议的解决方案' 清除缓存并重置所有内容 ' 不能工作。

但是,如果我将其发布到 https://www.npmjs.com/,该模块可以工作然后通过 npm install <module name> 安装它.

唯一的区别是安装方式。

最佳答案

我收到了一个类似的错误,提示它无法从它正在寻找的地方找到“路径”。最后我发现这个问题完全无关。以下自动导入被意外添加到我的代码中(可能是在我使用“textTransform”创建样式时)

import { transform } from "@babel/core";

一旦我注意到并将其删除,该项目就可以构建了。检查代码中最近的更改以查看是否添加了类似的内容可能会有所帮助。

关于reactjs - react native 问题 : Module does not exist in the Haste module map,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53096732/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com