尝试在原版 React Native 项目中解析 @expo/vector-icons/FontAwesome 时出错

问题描述

我今天遇到了这个奇怪的错误Unable to resolve module `@expo/vector-icons/FontAwesome` from `node_modules/react-native-elements/src/checkBox/CheckBoxIcon.js`: @expo/vector-icons/FontAwesome Could not be found within the project.

这个项目不使用 expo,它是使用 vanilla React Native CLI 构建的。我检查了 CheckBoxIcon.js 中的 node_modules 文件,但没有看到任何对 @expo 的引用。 不确定这是否重要,但在此之前我正在处理一个 xpo 项目,但它不应该影响我正在处理的这个单独的项目,是吗?

我不知道如何解决这个问题,我尝试过清除守望者手表、删除 node_modules 并重置 Metro 的缓存。

解决方法

npm start --reset-cache 不起作用,但 npm start -- --reset-cache 解决了我的问题。