HarmonyOS 鸿蒙Next entry:default@CompileArkTS. Node must have a real position for this operation
HarmonyOS 鸿蒙Next DevEco无法跑起工程 ERROR: Failed :entry:default@CompileArkTS… False expression: Node must have a real position for this operation
编译日志:
hvigor ERROR: Failed :entry:default[@CompileArkTS](/user/CompileArkTS)...
hvigor ERROR: Debug Failure. False expression: Node must have a real position for this operation
COMPILE RESULT:FAIL {ERROR:1 WARN:859}
at runArkPack (/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor-ohos-plugin/node_modules/@ohos/hvigor-arkts-compose/dist/src/arkts-pack.js:1:5337)
Error: Debug Failure. False expression: Node must have a real position for this operation
at NodeObject.assertHasRealPosition (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:171220:22)
at NodeObject.getStart (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:171226:18)
at validatePropertyAccessExpressionOnSpanComponent (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/lib/process_component_build.js:1:73298)
at bindComponentAttr (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/lib/process_component_build.js:1:58580)
at processExtend (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/lib/process_ui_syntax.js:1:28614)
at p (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/lib/process_ui_syntax.js:1:8220)
at visitArrayWorker (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:93755:48)
at visitNodes (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:93719:23)
at visitLexicalEnvironment (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:93785:22)
at visitEachChildOfSourceFile (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:94348:59)
hvigor ERROR: BUILD FAILED in 1 min 17 s 775 ms
出错前的一些操作:
升级了deveco,但我尝试了卸载devceo再重新安装旧版本,仍然是这错误
我将我的工程复制了一份在同一个目录,原工程叫proj_app 复制工程叫proj_app2, 并启动了一个新的deveco来运行proj_app2,我本来是想两个deveco分别在两个分支上改,节省切分支的操作,但此时导致两个工程都跑不起来了,怀疑就是这个原因
更多关于HarmonyOS 鸿蒙Next entry:default@CompileArkTS. Node must have a real position for this operation的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
如下麻烦您全局搜索看下,是否使用了扩展组件样式[@Extend](/user/Extend)(Span),并且使用了span不支持的属性。
如height属性,错误示范:
@Extend(Span) function fancySpan(weightValue: number, color: Color) {
.fontWeight(weightValue)
.height(300)
.fontColor(color)
}
更多关于HarmonyOS 鸿蒙Next entry:default@CompileArkTS. Node must have a real position for this operation的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
针对您提到的HarmonyOS鸿蒙Next DevEco无法跑起工程,并出现错误ERROR: Failed :entry:default@CompileArkTS... False expression: Node must have a real position for this operation
的问题,这通常是由于项目配置或代码中存在某些不一致性导致的。
-
检查项目配置文件:确保
tsconfig.json
或相关配置文件中的路径、依赖和编译选项正确无误。特别是检查ArkTS(ArkUI的TypeScript扩展)相关的配置是否完整且正确。 -
清理和重建项目:尝试清理项目(如删除
build
目录),然后重新构建,看是否能解决问题。 -
检查ArkTS代码:确保ArkTS代码中没有语法错误,特别是与组件位置相关的代码,如
@Entry
、@Component
等装饰器的使用是否正确。 -
更新DevEco Studio和工具链:确保您使用的DevEco Studio和所有相关工具链都是最新版本,以兼容最新的HarmonyOS SDK。
如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html。