崔先生
崔先生
  • 发布:2024-08-12 14:14
  • 更新:2024-08-12 15:24
  • 阅读:177

【报Bug】vue3 cli 创建的 uni-app 项目 更新依赖到最新版本以后报错

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: M2

浏览器平台: Chrome

浏览器版本: 版本 126.0.6478.127(正式版本) (arm64)

项目创建方式: CLI

CLI版本号: v16.18.0

bug描述:

左侧是老版本的依赖,右侧是根据最新cli 拉去的最新依赖版本,老版本的依赖安装完 h5 可以正常启动,更新到最新版本以后就报错

{
"name": "app",
"version": "0.0.0",
"scripts": {
"dev:app": "uni -p app",
"dev:app-android": "uni -p app-android",
"dev:app-ios": "uni -p app-ios",
"dev:h5": "uni",
"build:app": "uni build -p app",
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:h5": "uni build"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-3061520221228001",
"@dcloudio/uni-app-plus": "3.0.0-3061520221228001",
"@dcloudio/uni-components": "3.0.0-3061520221228001",
"@dcloudio/uni-h5": "3.0.0-3061520221228001",
"@dcloudio/uni-quickapp-webview": "3.0.0-3061520221228001",
"@vingogo/uni-ui": "^0.8.0",
"dayjs": "^1.11.10",
"pinia": "<=2.0.14",
"pinia-plugin-persistedstate": "^3.2.1",
"vue": "^3.2.13",
"vue-i18n": "^9.1.9"
},
"devDependencies": {
"@dcloudio/types": "^3.0.17",
"@dcloudio/uni-automator": "3.0.0-3061520221228001",
"@dcloudio/uni-cli-shared": "3.0.0-3061520221228001",
"@dcloudio/uni-stacktracey": "3.0.0-3061520221228001",
"@dcloudio/vite-plugin-uni": "3.0.0-3061520221228001",
"sass": "^1.69.5",
"sass-loader": "10",
"sass-resources-loader": "^2.2.5",
"vite": "3.2.4"
}
}
这个是 老版本的 cli的 package.json 文件 可以正常启动
{
"name": "app",
"version": "0.0.0",
"scripts": {
"dev:app": "uni -p app",
"dev:app-android": "uni -p app-android",
"dev:app-ios": "uni -p app-ios",
"dev:h5": "uni",
"build:app": "uni build -p app",
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:h5": "uni build"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-4020420240722002",
"@dcloudio/uni-app-plus": "3.0.0-4020420240722002",
"@dcloudio/uni-components": "3.0.0-4020420240722002",
"@dcloudio/uni-h5": "3.0.0-4020420240722002",
"@dcloudio/uni-quickapp-webview": "3.0.0-4020420240722002",
"@vingogo/uni-ui": "^0.8.0",
"dayjs": "^1.11.10",
"pinia": "<=2.0.14",
"pinia-plugin-persistedstate": "^3.2.1",
"vue": "^3.4.37",
"vue-i18n": "^9.13.1"
},
"devDependencies": {
"@dcloudio/types": "^3.4.12",
"@dcloudio/uni-automator": "3.0.0-4020420240722002",
"@dcloudio/uni-cli-shared": "3.0.0-4020420240722002",
"@dcloudio/uni-stacktracey": "3.0.0-4020420240722002",
"@dcloudio/vite-plugin-uni": "3.0.0-4020420240722002",
"sass": "^1.69.5",
"sass-loader": "10",
"sass-resources-loader": "^2.2.5",
"vite": "5.2.8"
}
}
更新依赖版本以后 启动报错

error when starting dev server:
TypeError: Cannot read properties of undefined (reading 'forEach')
at normalizeUniConfigThemeJsonIconPath (/Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-cli-shared@3.0.0-4020420240722002_postcss@8.4.41_ts-node@10.9.2_vue@3.4.37/node_modules/@dcloudio/uni-cli-shared/dist/json/theme.js:51:21)
at /Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-cli-shared@3.0.0-4020420240722002_postcss@8.4.41_ts-node@10.9.2_vue@3.4.37/node_modules/@dcloudio/uni-cli-shared/dist/json/theme.js:81:9
at /Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-shared@3.0.0-4020420240722002/node_modules/@dcloudio/uni-shared/dist/uni-shared.cjs.js:504:22
at initTheme (/Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-cli-shared@3.0.0-4020420240722002_postcss@8.4.41_ts-node@10.9.2_vue@3.4.37/node_modules/@dcloudio/uni-cli-shared/dist/json/theme.js:88:62)
at normalizeNavigationBar (/Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-cli-shared@3.0.0-4020420240722002_postcss@8.4.41_ts-node@10.9.2_vue@3.4.37/node_modules/@dcloudio/uni-cli-shared/dist/json/pages.js:332:55)
at normalizePageStyle (/Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-cli-shared@3.0.0-4020420240722002_postcss@8.4.41_ts-node@10.9.2_vue@3.4.37/node_modules/@dcloudio/uni-cli-shared/dist/json/pages.js:255:39)
at /Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-cli-shared@3.0.0-4020420240722002_postcss@8.4.41_ts-node@10.9.2_vue@3.4.37/node_modules/@dcloudio/uni-cli-shared/dist/json/pages.js:157:22
at Array.forEach (<anonymous>)
at normalizePages (/Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-cli-shared@3.0.0-4020420240722002_postcss@8.4.41_ts-node@10.9.2_vue@3.4.37/node_modules/@dcloudio/uni-cli-shared/dist/json/pages.js:156:11)
at normalizePagesJson (/Users/cuijingtao/Desktop/ms-monorepo/node_modules/.pnpm/@dcloudio+uni-cli-shared@3.0.0-4020420240722002_postcss@8.4.41_ts-node@10.9.2_vue@3.4.37/node_modules/@dcloudio/uni-cli-shared/dist/json/pages.js:107:5)

2024-08-12 14:14 负责人:无 分享
已邀请:
BFC

BFC

  • 崔先生 (作者)

    好的,谢谢

    2024-08-12 15:34

要回复问题请先登录注册