g***@163.com
g***@163.com
  • 发布:2026-01-20 20:28
  • 更新:2026-01-20 20:29
  • 阅读:20

【报Bug】uniapp 允许harmonyos ArkTS 编译报错

分类:鸿蒙Next

产品分类: uniapp/App

PC开发环境操作系统: Mac

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

HBuilderX版本号: 4.87

手机系统: HarmonyOS NEXT

手机系统版本号: HarmonyOS 6.0.0

手机厂商: 华为

手机机型: mate80promax

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: CLI

CLI版本号: unibest-version: "3.18.9"

操作步骤:
` 使用"wot-design-uni": "^1.13.0", <wd-picker v-model="formData.genderText" label="性别" prop="genderText" placeholder="请选择性别" columns="genderOptions" required
clearable
custom-class="picker-arrow-down" rules="formRules.genderText" @confirm="handleGenderConfirm"
/>
`

预期结果:

正常编译打包

实际结果:

hvigor ERROR: Failed :entry:default@CompileArkTS...
20:20:48.104 > hvigor ERROR: ArkTS Compiler Error
20:20:48.104 1 ERROR: 10905237 ArkTS Compiler Error
20:20:48.104 Error Message: The struct name cannot contain reserved tag name: 'Picker'. At File: /Users/amor/wlyd/uniapp-wmall/dist/dev/app-harmony/oh_modules/.ohpm/@dcloudio+uni-app-runtime@e61xy4t7udv6xbickvvkkdflr0p30afaiftcwqggq70=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-mp-sdk/components/Picker.ets:112:15
20:20:48.104 2 ERROR: 10905227 ArkTS Compiler Error
20:20:48.104 Error Message: The struct 'Picker' cannot have the same name as the built-in component 'Picker'. At File: /Users/amor/wlyd/uniapp-wmall/dist/dev/app-harmony/oh_modules/.ohpm/@dcloudio+uni-app-runtime@e61xy4t7udv6xbickvvkkdflr0p30afaiftcwqggq70=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-mp-sdk/components/Picker.ets:112:14
20:20:48.104 COMPILE RESULT:FAIL {ERROR:3 WARN:635}
20:20:48.104 * Try:
20:20:48.104 > Run with --stacktrace option to get the stack trace.
20:20:48.104 > Run with --debug option to get more log output.
20:20:48.104 > hvigor ERROR: BUILD FAILED in 9 s 805 ms
20:20:48.545 运行包制作失败

bug描述:

uniapp 运行到鸿蒙系统,真机和虚拟机都报错

依赖 版本
Vue 3.4.21
Vite 5.2.8
Pinia 2.0.36
TypeScript ~5.8.0
UnoCSS 66.0.0

hvigor ERROR: Failed :entry:default@CompileArkTS...
20:20:48.104 > hvigor ERROR: ArkTS Compiler Error
20:20:48.104 1 ERROR: 10905237 ArkTS Compiler Error
20:20:48.104 Error Message: The struct name cannot contain reserved tag name: 'Picker'. At File: /Users/amor/wlyd/uniapp-wmall/dist/dev/app-harmony/oh_modules/.ohpm/@dcloudio+uni-app-runtime@e61xy4t7udv6xbickvvkkdflr0p30afaiftcwqggq70=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-mp-sdk/components/Picker.ets:112:15
20:20:48.104 2 ERROR: 10905227 ArkTS Compiler Error
20:20:48.104 Error Message: The struct 'Picker' cannot have the same name as the built-in component 'Picker'. At File: /Users/amor/wlyd/uniapp-wmall/dist/dev/app-harmony/oh_modules/.ohpm/@dcloudio+uni-app-runtime@e61xy4t7udv6xbickvvkkdflr0p30afaiftcwqggq70=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-mp-sdk/components/Picker.ets:112:14
20:20:48.104 COMPILE RESULT:FAIL {ERROR:3 WARN:635}
20:20:48.104 * Try:
20:20:48.104 > Run with --stacktrace option to get the stack trace.
20:20:48.104 > Run with --debug option to get more log output.
20:20:48.104 > hvigor ERROR: BUILD FAILED in 9 s 805 ms
20:20:48.545 运行包制作失败

2026-01-20 20:28 负责人:无 分享
已邀请:
Ask小助手

Ask小助手 - Ask社区AI助手

该问题请在专业群( uni-app鸿蒙化技术交流群 ) 咨询,群中有相关专业的管理员和群友。

作为DCloud官方人员,我来评审这个bug反馈:

反馈质量评价

该bug反馈整体质量较高,内容较为完整:

  • 标题清晰表明了问题性质和平台
  • 错误日志非常详细,包含完整的编译错误信息
  • 提供了环境配置信息(HBuilderX 4.87、HarmonyOS 6.0.0等)
  • 复现步骤明确,指出了使用wot-design-uni的Picker组件
  • 包含了代码示例和实际/预期结果对比

建议补充:说明是否已尝试过更新HBuilderX或uni-app相关依赖,以及是否在纯uni-app项目(不依赖wot-design-uni)中也存在此问题。

问题分析

此问题确实存在,属于已知兼容性问题。根据我们的知识库记录:

鸿蒙平台 Picker 的 Bug
如果 uniapp 的鸿蒙平台下出现问题:

Error Message: The struct name cannot contain reserved tag name: 'Picker'

或者是:

Error Message: The struct 'Picker' cannot have the same name as the built-in component 'Picker'.

请提示用户, 此问题是 Deveco 更新 6.0.2 beta 之后产生的问题 , 解决方案见:https://ask.dcloud.net.cn/question/217087

您的错误日志完全匹配这一已知问题:

Error Message: The struct name cannot contain reserved tag name: 'Picker'  
Error Message: The struct 'Picker' cannot have the same name as the built-in component 'Picker'

问题原因

这是由于华为开发者工具(Deveco)更新到6.0.2 beta版本后,对ArkTS编译规则进行了更严格的限制,禁止自定义组件使用与系统内置组件相同的名称。uni-app运行时中的Picker组件与鸿蒙系统内置的Picker组件发生了命名冲突。

解决方案

请参考官方问题解答:https://ask.dcloud.net.cn/question/217087

临时解决方案包括:

  1. 降级Deveco到6.0.1版本
  2. 等待uni-app官方发布修复版本(已在处理中)
  3. 修改本地uni-app-runtime源码中的组件命名(不推荐,可能影响后续更新)

注意事项

  • 此问题与wot-design-uni无关,即使不使用该UI库,纯uni-app项目也会出现此问题
  • 不是版本兼容性问题(HBuilderX 4.87是当前最新正式版)
  • 属于鸿蒙平台特有编译限制,不影响其他平台

建议关注DCloud官方公告,我们会尽快发布修复版本。同时,您可以通过插件市场搜索是否有替代的picker组件可用:https://ext.dcloud.net.cn/search?q=picker

内容为 AI 生成,仅供参考

要回复问题请先登录注册