-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dumi 中 @ant-design/icons-svg/package.json 依赖包找不到 React 版本警告 #1904
Comments
|
是的,我也认为不需要react ,但是这个报错信息确实是缺少react 。 使用操作 npx create-dumi 创建项目后选择 Static Site 后运行项目控制台就警告找不到react 报错行 :client.js:169 报错信息 :No required version specified and unable to automatically determine one. Unable to find required version for "react" in description file (/node_modules/@ant-design/icons-svg/package.json). It need to be in dependencies, devDependencies or peerDependencies. |
报错堆栈贴一下? |
应该是 dumi 上游 umijs 用了 Webpack Module Federation 的特性导致的。查阅了几个相关的 issue, 貌似没找到解决方案,一个最简单粗暴的方法就是在 ref: |
* chore: 验证依赖缺失警告 ref: umijs/dumi#1904 (comment) * chore: update lock file * chore: update site
我创建使用了dumi 创建了项目但是在安装完依赖以后,我在控制台得到了找不到 React 版本警告
具体报错信息:
No required version specified and unable to automatically determine one. Unable to find required version for "react" in description file (/node_modules/@ant-design/icons-svg/package.json). It need to be in dependencies, devDependencies or peerDependencies.
环境:
node 版本:v16.20.1
芯片:m1
dumi版本:"dumi": "^2.2.0" 和 "dumi": "^2.2.10" 均发现此问题
我单独测试l @ant-design/icons-svg 包 并未发现警告
下附测试环境:
测试 @ant-design/icons-svg在 npx create-react-app my-app 创建的项目中正常渲染
测试react 版本:"^18.2.0"
解决方案:
在 node_modules 里向 @ant-design/icons-svg/package.json 字段中添加具体的 React版本号,同时在项目的package.json 里也添加
React版本号。二者缺一不可。
The text was updated successfully, but these errors were encountered: