ant-design-pro: 🐛 [BUG] The token 'colorBgBody' of Layout had deprecated, use 'bodyBg' instead
🐛 bug 描述
项目可以正常运行,但是会抛出异常:The token 'colorBgBody' of Layout had deprecated, use 'bodyBg' instead.
看起来是Layout 版本问题,
📷 复现步骤 | Recurrence steps
1.pro create myapp 初始化项目
2.npm install 安装默认依赖
3.执行 npm run dev
启动并在浏览器访问
© 版本信息
- Ant Design Pro 版本: v5
- umi 版本 v4
- 浏览器环境 Chrome 版本 116.0.5845.179
- 开发环境 mac OS
项目依赖如下:
"dependencies": {
"@ant-design/icons": "^4.8.0",
"@ant-design/pro-components": "^2.3.57",
"@ant-design/use-emotion-css": "1.0.4",
"@umijs/route-utils": "^2.2.2",
"antd": "^5.2.2",
"classnames": "^2.3.2",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"omit.js": "^2.0.2",
"rc-menu": "^9.8.2",
"rc-util": "^5.27.2",
"react": "^18.2.0",
"react-dev-inspector": "^1.8.4",
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0"
},
"devDependencies": {
"@ant-design/pro-cli": "^2.1.5",
"@testing-library/react": "^13.4.0",
"@types/classnames": "^2.3.1",
"@types/express": "^4.17.17",
"@types/history": "^4.7.11",
"@types/jest": "^29.4.0",
"@types/lodash": "^4.14.191",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react-helmet": "^6.1.6",
"@umijs/fabric": "^2.14.1",
"@umijs/lint": "^4.0.52",
"@umijs/max": "^4.0.52",
"cross-env": "^7.0.3",
"eslint": "^8.34.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unicorn": "^48.0.1",
"express": "^4.18.2",
"lint-staged": "^10.5.4",
"mockjs": "^1.1.0",
"prettier": ">=3.0.0",
"swagger-ui-dist": "^4.15.5",
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"umi-presets-pro": "^2.0.2"
},
🚑 以下是详细报错信息
Warning: The token 'colorBgBody' of Layout had deprecated, use 'bodyBg' instead.
at http://localhost:8000/mf-dep____vendor.297da593.js:142950:18
at Header
at MotionWrapper (http://localhost:8000/mf-dep____vendor.297da593.js:130804:5)
at ProviderChildren (http://localhost:8000/mf-dep____vendor.297da593.js:131272:5)
at ConfigProvider (http://localhost:8000/mf-dep____vendor.297da593.js:131520:54)
at DefaultHeader (http://localhost:8000/mf-dep____vendor.297da593.js:70134:24)
at div
at div
at http://localhost:8000/mf-dep____vendor.297da593.js:142970:42
at Layout
at div
at BaseProLayout (http://localhost:8000/mf-dep____vendor.297da593.js:67893:13)
at MotionWrapper (http://localhost:8000/mf-dep____vendor.297da593.js:130804:5)
at ProviderChildren (http://localhost:8000/mf-dep____vendor.297da593.js:131272:5)
at ConfigProvider (http://localhost:8000/mf-dep____vendor.297da593.js:131520:54)
at SWRConfig (http://localhost:8000/mf-dep____vendor.297da593.js:306436:13)
at ConfigProviderContainer (http://localhost:8000/mf-dep____vendor.297da593.js:82777:24)
at LocaleProvider (http://localhost:8000/mf-dep____vendor.297da593.js:144220:5)
at MotionWrapper (http://localhost:8000/mf-dep____vendor.297da593.js:130804:5)
at ProviderChildren (http://localhost:8000/mf-dep____vendor.297da593.js:131272:5)
at ConfigProvider (http://localhost:8000/mf-dep____vendor.297da593.js:131520:54)
at ProConfigProvider (http://localhost:8000/mf-dep____vendor.297da593.js:82896:24)
at MotionWrapper (http://localhost:8000/mf-dep____vendor.297da593.js:130804:5)
at ProviderChildren (http://localhost:8000/mf-dep____vendor.297da593.js:131272:5)
at ConfigProvider (http://localhost:8000/mf-dep____vendor.297da593.js:131520:54)
at ProLayout (http://localhost:8000/mf-dep____vendor.297da593.js:68225:28)
at http://localhost:8000/umi__plugin-layout__Layout.async.js:209:66
at Suspense
at RemoteComponent (http://localhost:8000/mf-dep____vendor.297da593.js:118854:25)
at Routes (http://localhost:8000/mf-dep____vendor.297da593.js:118405:76)
at Router (http://localhost:8000/mf-dep____vendor.297da593.js:292675:15)
at BrowserRoutes (http://localhost:8000/mf-dep____vendor.297da593.js:118365:23)
at r (http://localhost:8000/mf-dep____vendor.297da593.js:291384:7350)
at Provider (http://localhost:8000/src_umi_umi_ts.async.js:1787:74)
at InitialStateProvider (http://localhost:8000/src_umi_umi_ts.async.js:2128:117)
at Provider (http://localhost:8000/src_umi_umi_ts.async.js:2537:34)
at ProviderWrapper (http://localhost:8000/src_umi_umi_ts.async.js:2739:114)
at Browser (http://localhost:8000/mf-dep____vendor.297da593.js:118470:68)
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 15
👍是的,升级到
"antd": "^5.9.3"
然后清理掉src/.umi
临时文件,再重新安装了一遍node_modules
后确实不再报这个错了。