initRemoteConfig err: ReferenceError: Cannot find module '@test/remoteconfig' imported from 'com.example.testsample/entry@testCore/ets/com/solar/engine/remoteconfig/testBridge'. > hvigor ERROR: Failed :entry:default@CompileArkTS... > hvigor ERROR: Cannot read properties of undefined (reading 'split') 1 ERROR: 10311002 ArkTS: ERROR ERROR: ArkTS:ERROR Failed to resolve OhmUrl.Error Message: Failed to get a resolved OhmUrl for ${filePath} imported by ${importerFile}.
WARN: The current module 'ImportTest' has dependency which is not installed at its oh-package.json5 ... local dependency "lib" found in "D:\W\code\demo\fasttest\ImportTest\oh-package.json5" does not match the actual name "har" of its oh-package.json5 ... There are some dependency names that are inconsistent with the actual package names.
[+2714 ms] Exitcode 1 from: ohpm install --all [ ] ohpm INFO: MetaDataFetcher fetching meta info of package '@tencent/mmkv' from https://ohpm.openharmony.cn/ohpm/ ohpm INFO: MetaDataFetcher fetching meta info of package '@ohos/hypiu' from https://ohpm.openharmony.cn/ohpm/ ohpm ERROR: Run install command failed Error: XXXXXXXX Fetch Local Package Failed Error Message: Fetch local file package error, /Users/XXX/XXX/XXX/ohos/har/screen_retriever.har does not exist. [ +1 ms] "flutter hap" took 14,528ms. [ +2 ms] Oops; flutter has exited unexpectedly: "ProcessException: The command failed with exit code 1 Command: ohpm install --all".
根据运行错误日志,排查testBridge文件到代码位置如下:
let harName = '@test/remoteconfig'; import (harName).then((ns:ESObject) => { ns.startWithConfig(context,rcConfig,logLevel); }).catch((error:Error) =>{ LogUtil.error(TAG, "initRemoteConfig err: " + error); });
排查build-profile.json5文件,没有发现runtimeOnly配置。根据ReferenceError: Cannot find module关键日志,可确认问题根因是引用错误,无法找到模块。