vite build react项目时报错 LibraryManagedAttributes

原因是项目中不同的lib依赖了不同的react版本,所以react的类型声明就重复了,所以校验不通过。yarn才会有这种教研。

参考:https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33822

解决办法尝试三种:我只尝试了第一种 就成功了

1. 删掉yarn.lock,重新yarn install

2. 安装yarn add --dev @types/react

3. npx yarn-deduplicate --packages @types/react yarn.lock

 

posted on 2022-03-24 20:40  yoyo002  阅读(256)  评论(0编辑  收藏  举报