【发布时间】:2020-11-08 11:34:32
【问题描述】:
你好,
我正在使用 typescript 开发一个电子应用程序,该应用程序在编译时出现以下错误消息(从技术上讲,其中有五个,但它们都是相同类型的错误,只是与不同的部分冲突)
node_modules/@types/body-parser/index.d.ts(12,23): error TS4090: Conflicting definitions for 'node' found at '.../node_modules/@types/node/index.d.ts' and './node_modules/electron/node_modules/@types/node/index.d.ts'. Consider installing a specific version of this library to resolve the conflict.
所以这意味着我有两个用于“节点”的类型库 - 但是,我的 package.json 中没有包含 @types/node 库(因为它显然默认存在于电子中)。因此,我对如何解决这个问题感到非常困惑和迷茫。
我尝试删除 node_modules 和 yarn.lock 并从头开始重建模块,删除 @types/node 或 electron/.../@types/node,甚至删除这些引用的所有代码并逐渐再次重建它们。没有工作。 我也尝试使用这里提到的解决方案:https://github.com/electron/electron/issues/10167 但无济于事。
在错误消息中写着“考虑安装此库的特定版本以解决冲突” - 我该怎么做?
希望这是足够的信息,
干杯
【问题讨论】:
标签: typescript electron