问题:
下载的是最新的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