hvigor ERROR: Cannot find module ‘@ohos/hvigor‘

问题:

下载的是最新的DevEco Studio 5.0.0 Release,新建的Hello World项目,Preview failed。

尝试了卸载重装Studio,还是报错。

dart 复制代码
"D:\Soft\Huawei\DevEco Studio\tools\node\node.exe" "D:\Soft\Huawei\DevEco Studio\tools\hvigor\bin\hvigorw.js" --mode module -p module=entry@default -p product=default -p pageType=page -p compileResInc=true -p previewMode=true -p buildRoot=.preview PreviewBuild --watch --analyze=normal --parallel --incremental --daemon

> hvigor Finished :entry:default@PreBuild... after 77 ms 

> hvigor Finished :entry:default@MergeProfile... after 4 ms 

> hvigor Finished :entry:default@CreateBuildProfile... after 3 ms 

> hvigor Finished :entry:default@PreCheckSyscap... after 1 ms 

> hvigor Finished :entry:default@GeneratePkgContextInfo... after 1 ms 

> hvigor Finished :entry:default@ProcessProfile... after 107 ms 

> hvigor Finished :entry:default@ProcessRouterMap... after 5 ms 

> hvigor Finished :entry:default@PreviewProcessResource... after 2 ms 

> hvigor Finished :entry:default@GenerateLoaderJson... after 11 ms 

> hvigor Finished :entry:default@PreviewCompileResource... after 105 ms 

> hvigor Finished :entry:default@PreviewHookCompileResource... after 1 ms 

> hvigor Finished :entry:default@CopyPreviewProfile... after 7 ms 

> hvigor Finished :entry:default@ReplacePreviewerPage... after 1 ms 

> hvigor Finished :entry:buildPreviewerResource... after 1 ms 

> hvigor Finished :entry:default@PreviewUpdateAssets... after 2 ms 

> hvigor ERROR: Failed :entry:default@PreviewArkTS... 

> hvigor ERROR: Cannot find module '@ohos/hvigor'

Require stack:

- D:\Soft\Huawei\DevEco Studio\tools\hvigor\hvigor-ohos-plugin\src\tasks\worker\preview-build.js

> hvigor ERROR: BUILD FAILED in 525 ms 

Process finished with exit code -1

原因:

之前开发前端项目时,下载并配置了 低版本的node_path,导致 @ohos/hvigor 下载失败了。

解决方法:

1、去 高级系统设置 -- 环境变量中,删除 node_path 变量。

2、clean project

3、重启 DevEco Studio

相关推荐
爱笑的眼睛113 小时前
HarmonyOS 应用开发深度解析:ArkTS 声明式 UI 与状态管理最佳实践
华为·harmonyos
安卓开发者3 小时前
鸿蒙Next ArkWeb进程解析:多进程架构如何提升Web体验
前端·架构·harmonyos
damo王5 小时前
鸿蒙(HarmonyOS) 历史
华为·harmonyos
爱笑的眼睛116 小时前
HarmonyOS声明式UI开发:深入ArkUI与状态管理实践
华为·harmonyos
爱笑的眼睛116 小时前
HarmonyOS 应用开发进阶:深入 Stage 模型与 ArkUI 声明式开发实践
华为·harmonyos
2501_919749036 小时前
鸿蒙:更改状态栏、导航栏颜色
华为·harmonyos
2501_919749036 小时前
鸿蒙:@Builder 和 @BuilderParam正确使用方法
华为·harmonyos
爱笑的眼睛116 小时前
HarmonyOS应用开发:深入解析Stage模型与UIAbility
华为·harmonyos
HMSCore9 小时前
Cloud Foundation Kit启动预加载,赋能喜马拉雅秒启秒开流畅体验
harmonyos
我在看你呵呵笑1 天前
GD32VW553-IOT开发板移植适配openharmony
物联网·华为·harmonyos