鸿蒙开发运行报错:Sync failed.The hvigorVersion version (2.x.x) is not within the expected range 3.x.x

文章讲述了在将项目从DevEchoStudio3.x导入到4.x时遇到的hvigorVersion版本不匹配问题,解决方案是升级hvigorVersion和相关插件至3.0.9,并同步项目。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错截图

Sync failed.

Cause: 1.The hvigorVersion version (2.4.2) is not within the expected range 3.x.x 
(3.x.x >= 3.0.9). 2.The @ohos/hvigor-ohos-plugin version (2.4.2) is not within the 
expected range 3.x.x (3.x.x >= 3.0.9). 
Solution: Change the values of 
hvigorVersion to 3.0.9 and @ohos/hvigor-ohos-plugin to 3.0.9, while updating the 
command line script hvigor-wrapper.js that matches hvigor, which will auto-install
 the respective versions of the tools. Then sync the project again.
 

报错原因

日志中已经明显给出了,报错是 hvigorVersion 版本差异导致的,产生这个问题之前的操作是导入项目到DevEcho Studio中。由于IDE版本差异,原项目是基于 DevEcho Studio 3.x 构建的,导入到 DevEcho Studio 4.x 中而出现的问题。

报错解决

同样日志中也给出了解决方案:

**升级hvigorVersion **,然后再次同步项目。

也就是点击报错截图中蓝色链接即可

在这里插入图片描述

再次构建就能正常运行了

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值