鸿蒙OS导入项目报错不能运行 @ohos\hvigor\bin\hvigor.js‘

在自学HarmonyOS时,想在DevEco Studio导入官方示例代码:**待办列表(ArkTS)**报错

C:\Users\woods\Downloads\test01\ToDoListArkTS\node_modules\@ohos\hvigor\bin\hvigor.js --mode module -p module=entry@default -p product=default -p compileResInc=true -p buildRoot=.preview -p previewMode=true buildPreviewerResource

node:internal/modules/cjs/loader:1024

throw err;

^

Error: Cannot find module 'C:\Users\woods\Downloads\test01\ToDoListArkTS\node_modules\@ohos\hvigor\bin\hvigor.js'

at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1021:15)

at Function.Module._load (node:internal/modules/cjs/loader:866:27)

at Function.executeUserEntryPoint as runMain (node:internal/modules/run_main:81:12)

at node:internal/main/run_main_module:22:47 {

code: 'MODULE_NOT_FOUND',

requireStack: \[\]

}

Process finished with exit code 1

点击右上角的 Notification 通知面板

这有个提示报错提示,大致意思是版本不一致

Sync failed. Follow the given solution

import导入时界面报错,直接点击解决方案,执行命令安装指定版本

安装好依赖又报这个错,看意思应该是只有页面文件才可以运行

找到要运行的ets页面

这样我们导入的项目就可以运行了

相关推荐
OH_TPC1 小时前
【鸿蒙优选三方库】@ohos/coap:让鸿蒙设备说上 IoT 的母语
物联网·华为·harmonyos·鸿蒙
程序猿追2 小时前
渐变中间那一格怎么算?用 colormath 做个鸿蒙调色器
华为·harmonyos
程序猿追3 小时前
在 HarmonyOS 6 上做了张 3D 翻转卡片,正面背面来回翻
3d·华为·harmonyos
小π军4 小时前
安卓、iOS、鸿蒙三端的理解
android·ios·harmonyos
m0_738185824 小时前
Flutter 鸿蒙化实战:volume_controller 适配 OpenHarmony,系统音量控制
flutter·华为·harmonyos·鸿蒙
用户117910488334 小时前
每个会话一个子进程:多会话真并行的架构取舍
开源·harmonyos
m0_738185824 小时前
Flutter 鸿蒙化实战:webview_cookie_manager 适配 OpenHarmony,WebView Cookie 管理
flutter·华为·harmonyos·鸿蒙
垆边人似月.4 小时前
华为题:编辑距离
算法·华为
尧炎科技5 小时前
2026新款半入耳降噪耳机推荐:华为FreeBuds 7 续航与防护
华为
2501_919749035 小时前
华为鸿蒙免费小组件APP—小羊小组件
华为·harmonyos