uniapp 打包鸿蒙5.0应用出现问题【华为根技术】
【摘要】 想把上架的 uniapp 小程序迁移到鸿蒙,结果一打包,ERROR × 3,WARN × 519,所以就简单记录一下解决这些错误的过程。首先先解决错误吧,错误的主要报错如下:1 ERROR: ArkTS:ERROR File: //?/E:/Projects/uniapp/x/crystal-chest/crystal-chest/unpackage/release/cn.techfanyi...
想把上架的 uniapp 小程序迁移到鸿蒙,结果一打包,ERROR × 3,WARN × 519,所以就简单记录一下解决这些错误的过程。
首先先解决错误吧,错误的主要报错如下:
1 ERROR: ArkTS:ERROR File: //?/E:/Projects/uniapp/x/crystal-chest/crystal-chest/unpackage/release/cn.techfanyi.crystalchest/oh_modules/.ohpm/@ohos+videocompressor@soegz02lhnnihit14ad03wcy4dhlg8y+cdslhkqxb5s=/oh_modules/@ohos/videocompressor/src/main/ets/components/mainpage/CompressorResponse.ets
A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.
* Try the following:
> Please make sure that the splash page has one and only one '@Entry' decorator.
2 ERROR: ArkTS:ERROR File: //?/E:/Projects/uniapp/x/crystal-chest/crystal-chest/unpackage/release/cn.techfanyi.crystalchest/oh_modules/.ohpm/@ohos+videocompressor@soegz02lhnnihit14ad03wcy4dhlg8y+cdslhkqxb5s=/oh_modules/@ohos/videocompressor/src/main/ets/components/mainpage/VideoCompressor.ets
A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.
* Try the following:
> Please make sure that the splash page has one and only one '@Entry' decorator.
COMPILE RESULT:FAIL {ERROR:3 WARN:519}
* Try the following:
> Check whether undefined attributes or methods are used in the hvigorconfig.ts and hvigorfile.ts files.
> Go to the official website for help
> More info: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-hvigor-faqs-V5#section119742124315
> hvigor ERROR: BUILD FAILED in 44 s 145 ms
13:23:21.003 安装包制作失败
两个错误都是因为
A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.
// 在 "main_pages.json 或 build-profile.json5 "中配置的页面必须有且仅有一个"@Entry "装饰器。
给出的建议是:
Please make sure that the splash page has one and only one '@Entry' decorator.
// 请确保闪屏页面只有一个"@Entry "装饰器。
去 Dcloud 论坛看到大概率是因为是项目路径里包含特殊字符,或者项目路径比较深(鸿蒙的项目某一个 ets 到盘符的路径超过 255 个字符就会编译 arkts 失败),会导致鸿蒙工具链执行异常。
也就是说,我现在的目录是 E:/Projects/uniapp/x/crystal-chest/crystal-chest/unpackage/release/cn.techfanyi.crystalchest/oh_modules/.ohpm/@ohos+videocompressor@soegz02lhnnihit14ad03wcy4dhlg8y+cdslhkqxb5s=/oh_modules/@ohos/videocompressor/src/main/ets/components/mainpage/CompressorResponse.ets
,我看了一下,有 265 个字符,我把这个项目移到根目录就差不多行啦!
再次编译就OK啦!其他的 WARN 估计也是因为这个原因。
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)