流年似_水
流年似_水
  • 发布:2024-07-16 23:29
  • 更新:2024-07-18 10:55
  • 阅读:354

【报Bug】使用 cli 方式更新后,报错

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Windows

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

浏览器平台: Chrome

浏览器版本: 126.0.6478.127

项目创建方式: CLI

CLI版本号: 3.0.0-4020320240708001

操作步骤:

package.json 文件内容如下,使用 import { createI18n } from 'vue-i18n' 后出现上述问题

{  
  "name": "uni-vue3-template",  
  "version": "0.0.0",  
  "private": true,  
  "scripts": {  
    "dev:app": "uni -p app",  
    "dev:app-android": "uni -p app-android",  
    "dev:app-ios": "uni -p app-ios",  
    "dev:custom": "uni -p",  
    "dev:h5": "uni",  
    "dev:h5:ssr": "uni --ssr",  
    "dev:mp-alipay": "uni -p mp-alipay",  
    "dev:mp-baidu": "uni -p mp-baidu",  
    "dev:mp-jd": "uni -p mp-jd",  
    "dev:mp-kuaishou": "uni -p mp-kuaishou",  
    "dev:mp-lark": "uni -p mp-lark",  
    "dev:mp-qq": "uni -p mp-qq",  
    "dev:mp-toutiao": "uni -p mp-toutiao",  
    "dev:mp-weixin": "uni -p mp-weixin",  
    "dev:mp-xhs": "uni -p mp-xhs",  
    "dev:quickapp-webview": "uni -p quickapp-webview",  
    "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",  
    "dev:quickapp-webview-union": "uni -p quickapp-webview-union",  
    "build:app": "uni build -p app",  
    "build:app-android": "uni build -p app-android",  
    "build:app-ios": "uni build -p app-ios",  
    "build:custom": "uni build -p",  
    "build:h5": "uni build",  
    "build:h5:ssr": "uni build --ssr",  
    "build:mp-alipay": "uni build -p mp-alipay",  
    "build:mp-baidu": "uni build -p mp-baidu",  
    "build:mp-jd": "uni build -p mp-jd",  
    "build:mp-kuaishou": "uni build -p mp-kuaishou",  
    "build:mp-lark": "uni build -p mp-lark",  
    "build:mp-qq": "uni build -p mp-qq",  
    "build:mp-toutiao": "uni build -p mp-toutiao",  
    "build:mp-weixin": "uni build -p mp-weixin",  
    "build:mp-xhs": "uni build -p mp-xhs",  
    "build:quickapp-webview": "uni build -p quickapp-webview",  
    "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",  
    "build:quickapp-webview-union": "uni build -p quickapp-webview-union",  
    "lint:fix": "eslint --fix"  
  },  
  "dependencies": {  
    "@dcloudio/uni-app": "3.0.0-4020320240708001",  
    "@dcloudio/uni-app-plus": "3.0.0-4020320240708001",  
    "@dcloudio/uni-components": "3.0.0-4020320240708001",  
    "@dcloudio/uni-h5": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-alipay": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-baidu": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-jd": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-kuaishou": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-lark": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-qq": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-toutiao": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-weixin": "3.0.0-4020320240708001",  
    "@dcloudio/uni-mp-xhs": "3.0.0-4020320240708001",  
    "@dcloudio/uni-quickapp-webview": "3.0.0-4020320240708001",  
    "@vueuse/core": "^10.9.0",  
    "axios": "^1.6.8",  
    "dayjs": "^1.11.11",  
    "lodash-es": "^4.17.21",  
    "pinia": "^2.1.7",  
    "vue": "3.4.21",  
    "vue-i18n": "^9.13.1",  
    "wot-design-uni": "^1.3.2"  
  },  
  "devDependencies": {  
    "@dcloudio/types": "^3.4.11",  
    "@dcloudio/uni-automator": "3.0.0-4020320240708001",  
    "@dcloudio/uni-cli-shared": "3.0.0-4020320240708001",  
    "@dcloudio/uni-stacktracey": "3.0.0-4020320240708001",  
    "@dcloudio/vite-plugin-uni": "3.0.0-4020320240708001",  
    "@eslint/js": "^9.6.0",  
    "@mini-types/alipay": "^3.0.14",  
    "@vue/runtime-core": "3.4.21",  
    "eslint": "^9.6.0",  
    "eslint-plugin-vue": "^9.27.0",  
    "globals": "^15.8.0",  
    "miniprogram-api-typings": "^3.9.1",  
    "prettier": "^3.3.2",  
    "sass": "^1.62.1",  
    "unplugin-auto-import": "^0.17.6",  
    "vite": "5.2.8"  
  },  
  "engines": {  
    "node": "^18.18.0 || ^20.9.0 || >=21.1.0",  
    "pnpm": ">=9"  
  }  
}

预期结果:

希望不报错,或者看能不能找到规避办法

实际结果:

目前是报错的

bug描述:

目前使用 cli 方式升级到最新版本,使用的是 pnpm 安装,运行起来后报错如下

Uncaught SyntaxError: The requested module '/node_modules/.pnpm/node_modules/@intlify/message-compiler/dist/message-compiler.esm-bundler.js?v=dad619dc' does not provide an export named 'CompileErrorCodes' (at core-base.mjs:7:28)

初步定位问题是使用了 vue-i18n 后出现的,把 vue-i18n 相关注释掉后就不会报错了,还有就是回退到上个版本 3.0.0-4010520240507001 后不用任何处理是不会报错的

2024-07-16 23:29 负责人:无 分享
已邀请:
BFC

BFC

如果有pnpm 使用需求,可以用pnpm安装 vue-i18n@9.1.9

pnpm install vue-i18n@9.1.9

  • y***@163.com

    9.19 也不行,同样回报错,cli安装默认就是9.19 的版本

    2024-08-30 17:06

  • BFC

    回复 y***@163.com: 可以检查一下node_modules里面的vue-i18n版本是不是9.1.9。或者直接不用安装vue-i18n。因为cli已经安装过了vue-i18n。 直接在代码里面使用 import xxx from 'vue-i18n'

    2024-08-30 17:13

BFC

BFC

你好,这边检查了一下, pnpm 无法正确解析安装vue-i18n 的依赖包。 建议你用yarn 安装 vue-i18n的依赖包。

  • 流年似_水 (作者)

    好的,谢谢,我下午也发现是这个问题,因为官方 @dcloudio/uni-cli-shared 这个包中有的依赖和 vue-i18n 中的依赖一样,只是版本不同,导致报错

    2024-07-18 21:57

  • 1***@qq.com

    回复 流年似_水: 你好请问 问题解决了吗,我也出现了相同的问题

    2024-09-19 11:37

  • BFC

    回复 1***@qq.com: 安装 vue-i18n@9.1.9 固定版本

    2024-09-19 14:26

要回复问题请先登录注册