yus*_*ulx 5 reactjs react-native
我创建了一个本地模块并创建了另一个项目来在本地测试它。
这是我的步骤:
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-*`.
Run Code Online (Sandbox Code Playgroud)
我已经在 StackOverflow 上搜索过这个问题,但没有可行的解决方案。建议的解决方案“清除缓存并重置所有内容”无法工作。
但是,如果我将其发布到https://www.npmjs.com/然后通过npm install <module name>
.
唯一的区别是安装方式。
我遇到了类似的错误,抱怨它如何无法从它正在寻找的地方找到“路径”。最后我发现这个问题完全无关。以下自动导入被意外添加到我的代码中(可能是当我使用“textTransform”创建样式时)
import { transform } from "@babel/core";
Run Code Online (Sandbox Code Playgroud)
一旦我注意到这一点并将其删除,该项目就可以构建了。检查代码中最近的更改以查看是否添加了类似的内容可能会有所帮助。
归档时间: |
|
查看次数: |
5672 次 |
最近记录: |