安装依赖报错(构建-同步-Ohpm Install或者终端执行ohpm install):
ohpm INFO: MetaDataFetcher fetching meta info of package '@ohos/hap' from https://ohpm.openharmony.cn/ohpm/ ohpm INFO: MetaDataFetcher fetching meta info of package '@ohos/system' from https://ohpm.openharmony.cn/ohpm/ ohpm WARN: fetch meta info of package '@ohos/system' failed - GET https://ohpm.openharmony.cn/ohpm/@ohos/system 404( undefined ) ohpm WARN: fetch meta info of package '@ohos/hap' failed - GET https://ohpm.openharmony.cn/ohpm/@ohos/hap 404( undefined ) ohpm ERROR: Run install command failed Error: 00617101 Fetch Pkg Info Failed Error Message: FetchPackageInfo: "@ohos/system" failed ╰→ Caused by: Original Error: NOTFOUND package '@ohos/system@1.0.0' not found from all the registries https://ohpm.openharmony.cn/ohpm/
ohpm ERROR: local dependency "@ohos/constantsCommon" found in "D:\xxx\entry\oh-package.json5" does not match the actual name "constantscommon" of its oh-package.json5 ohpm ERROR: Install failed, detail: There are some dependency names that are inconsistent with the actual package names.
Original Error: request to https://repo.harmonyos.com/ohpm/@pura/spinkit failed, reason: connect ETIMEDOUT xxx.xxx.xxx.xxx:443
ohpm ERROR: Run install command failed Error: 00625004 SymLink Dir Failed
ohpm ERROR: Invalid dependency @xxx/xxxx@1.0.29 -> @xxx/xxxx@1.1.44 ohpm ERROR: Found exception: Error: Invalid dependency, reached retry limit or non retryable error encountered.
ohpm ERROR: Run install command failed Error: 00617202 Fetch Local Package Failed Error Message: Fetch local file package error, D:\MyApplication\oh_modules\.ohpm\har@xxx =\oh_modules\har1.har does not exist.
根据错误码可知,ohpm配置的仓库中未包含依赖包。
根据报错日志分析:仓库是https://ohpm.openharmony.cn/ohpm/,即OpenHarmony三方库中心仓,检索未发现@ohos/system。
排查报错信息中oh-package.json5的依赖名和实际依赖包体中oh-package.json5的name字段,确认两者是否一致。
由报错信息connect ETIMEDOUT xxx.xxx.xxx.xxx:443可知,当前通过443端口访问仓库超时。通过DevEco Studio-帮助-诊断工具-诊断开发环境,确认网络连接状况。
由报错信息可知,依赖本地har包未找到。项目结构:entry依赖har.har,har.har依赖har1.har,排查har.har依赖配置oh-package.json5,发现依赖配置:"har1": "file:../har/libs/har1.har",依赖路径超出本包范围。