在Angular Tree组件上构建失败,并显示消息“没有导出的成员'Cancelable'”

问题描述

我在项目中使用Angular Tree Component,并且在过去的几天中,在构建Angular应用程序时出现以下错误。经过一番努力,问题得以解决。我在下面为社区发布我的答案。

2020-09-02T13:10:19.5809754Z ERROR in node_modules/angular-tree-component/dist/components/tree-viewport.component.d.ts(3,10): error TS2305: Module '"D:/eb/A3322/work/2/s/node_modules/@types/lodash/index"' has no exported member 'Cancelable'.
2020-09-02T13:10:19.5810790Z 
2020-09-02T13:10:19.7050898Z npm ERR! code ELIFECYCLE
2020-09-02T13:10:19.7053154Z npm ERR! errno 1

解决方法

最新版本的loadash(4.14.161)发生了重大变化。坚持低于161的版本,一切正常。 Angular-tree-component内部使用lodash。我在lodash版本上设置了上限,该版本会自动更新该组件,从而使查找起来更加困难。

已更改 “ @ types / lodash”:“ ^ 4.14.119”,

到 “ @ types / lodash”:“ 4.14.119”,