[ant-design/ant-design-pro]现有项目和新项目都出现依赖错误无法启动

2024-02-04 466 views
5
? bug 描述

Register plugin /Volumes/code/temporary/myapp/node_modules/_umi-plugin-antd-icon-config@2.0.3@umi-plugin-antd-icon-config/lib/index.js failed, since Cannot use import statement outside a module Error: Register plugin /Volumes/code/temporary/myapp/node_modules/_umi-plugin-antd-icon-config@2.0.3@umi-plugin-antd-icon-config/lib/index.js failed, since Cannot use import statement outside a module at Object.apply (/Volumes/code/temporary/myapp/nodemodules/@umijs_core@3.3.7@@umijs/core/lib/Service/utils/pluginUtils.js:159:15) at /Volumes/code/temporary/myapp/nodemodules/@umijs_core@3.3.7@@umijs/core/lib/Service/Service.js:348:22 at Generator.next () at asyncGeneratorStep (/Volumes/code/temporary/myapp/nodemodules/@umijs_core@3.3.7@@umijs/core/lib/Service/Service.js:108:103) at _next (/Volumes/code/temporary/myapp/nodemodules/@umijs_core@3.3.7@@umijs/core/lib/Service/Service.js:110:194) at /Volumes/code/temporary/myapp/nodemodules/@umijs_core@3.3.7@@umijs/core/lib/Service/Service.js:110:364 at new Promise () at /Volumes/code/temporary/myapp/nodemodules/@umijs_core@3.3.7@@umijs/core/lib/Service/Service.js:110:97 at Service.applyAPI (/Volumes/code/temporary/myapp/nodemodules/@umijs_core@3.3.7@@umijs/core/lib/Service/Service.js:355:7) at /Volumes/code/temporary/myapp/nodemodules/@umijs_core@3.3.7@@umijs/core/lib/Service/Service.js:438:20 ✨ Done in 2.01s.

项目使用老依赖可以正常启动,只要重新安装依赖就会报错,尝试创建新项目也出现以上问题。 版本: ant design pro v5; 系统mac

? 复现步骤 ? 期望结果 ? 复现代码 © 版本信息
  • Ant Design Pro 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]
? 其他信息

回答

9

+1 我今天也是这样,创建了个新的项目,然后yarn就报错了。

3

ant design pro v4 也不行,今天干不了活了

1

已经定位到是/node_module/@ant-design/colors出的问题,我用老的依赖覆盖这个目录就能正常启动,因为之前一直用的cnpm导致没有package-lock.json文件,现在用npm i --force生成的package-lock.json如何做修改能锁定之前的正常版本?

4

弟兄们,如果要正常的@ant-design依赖加我QQ307375473,免费提供给大家,确保大家能按时完成工作,安心过年

0

package.json加入"resolutions": { "@ant-design/colors": "5.0.0" }

2

666,兄弟牛掰

1

兄弟们把nodejs替换成Denojs,有做过么

9

已经发布了!可以不锁了