【问题标题】:Private react-native library all of a sudden can't be found even though I see it in the node_modules即使我在 node_modules 中看到私有 react-native 库也突然找不到
【发布时间】:2022-01-18 08:01:20
【问题描述】:

我有一个使用私有 react-native 库的 react-native 项目。之前一切正常,但现在我收到错误 Cannot find module 'library' or its corresponding type declarations.ts(2307)

如果我使用当天早些时候的包,一切正常。我比较了代码,只有 3 处更改。我删除了所有这些更改,但我仍然遇到同样的问题。我在 node_modules 中看到了库。它有一个 index.d.ts 文件和一个 index.ts 文件。我不知道出了什么问题,而且我基本上停留在以前的版本,因为我所做的任何更改或尝试将代码恢复到以前的包都具有与上述相同的结果。任何想法将不胜感激。

【问题讨论】:

    标签: react-native github npm


    【解决方案1】:

    好吧,不知道这是怎么发生的。唯一改变的是我更新了 VSCode,但我的 dist 文件夹中不再有 src 文件夹,所以我猜我的路径是关闭的。确保在我的 tsconfig 中导出到 dist/src,这样可以解决问题,以防其他人遇到此问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-20
      • 1970-01-01
      • 2020-03-24
      • 2021-09-07
      相关资源
      最近更新 更多