HarmonyOS 鸿蒙Next @ohpm/common 报错

发布于 1周前 作者 yuanlaile 来自 鸿蒙OS

HarmonyOS 鸿蒙Next @ohpm/common 报错

cke_1172.png
{
“name”: “phone”,
“version”: “1.0.0”,
“description”: “Please describe the basic information.”,
“main”: “”,
“author”: “”,
“license”: “”,
“dependencies”: {
@ohos/common”: “file:…/…/common”,
@ohos/mine”: “file:…/…/features/mine”,
@ohos/first”: “file:…/…/features/first”,
@ohos/find”: “file:…/…/features/find”,
@ohos/run”: “file:…/…/features/run”,
@ohos/shop”: “file:…/…/features/shop”,
@ohos/weightscale”: “file:…/…/IoT/weightscale”
}
}


/Applications/DevEco-Studio.app/Contents/tools/ohpm/bin/ohpm install --registry https://repo.harmonyos.com/ohpm/

ohpm WARN: local dependency “@ohos/common” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/first/oh-package.json5” does not match the actual name “common” of its oh-package.json5

ohpm WARN: local dependency “@ohos/common” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/find/oh-package.json5” does not match the actual name “common” of its oh-package.json5

ohpm WARN: local dependency “@ohos/common” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/shop/oh-package.json5” does not match the actual name “common” of its oh-package.json5

ohpm WARN: local dependency “@ohos/first” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/shop/oh-package.json5” does not match the actual name “first” of its oh-package.json5

ohpm WARN: local dependency “@ohos/mine” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/shop/oh-package.json5” does not match the actual name “mine” of its oh-package.json5

ohpm WARN: local dependency “@ohos/find” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/shop/oh-package.json5” does not match the actual name “find” of its oh-package.json5

ohpm WARN: local dependency “@ohos/common” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/mine/oh-package.json5” does not match the actual name “common” of its oh-package.json5

ohpm WARN: local dependency “@ohos/first” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/mine/oh-package.json5” does not match the actual name “first” of its oh-package.json5

ohpm WARN: local dependency “@ohos/find” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/mine/oh-package.json5” does not match the actual name “find” of its oh-package.json5

ohpm WARN: local dependency “@ohos/common” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/run/oh-package.json5” does not match the actual name “common” of its oh-package.json5

ohpm WARN: local dependency “@ohos/first” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/run/oh-package.json5” does not match the actual name “first” of its oh-package.json5

ohpm WARN: local dependency “@ohos/mine” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/run/oh-package.json5” does not match the actual name “mine” of its oh-package.json5

ohpm WARN: local dependency “@ohos/find” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/features/run/oh-package.json5” does not match the actual name “find” of its oh-package.json5

ohpm WARN: local dependency “@ohos/common” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/products/phone/oh-package.json5” does not match the actual name “common” of its oh-package.json5

ohpm WARN: local dependency “@ohos/mine” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/products/phone/oh-package.json5” does not match the actual name “mine” of its oh-package.json5

ohpm WARN: local dependency “@ohos/first” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/products/phone/oh-package.json5” does not match the actual name “first” of its oh-package.json5

ohpm WARN: local dependency “@ohos/find” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/products/phone/oh-package.json5” does not match the actual name “find” of its oh-package.json5

ohpm WARN: local dependency “@ohos/run” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/products/phone/oh-package.json5” does not match the actual name “run” of its oh-package.json5

ohpm WARN: local dependency “@ohos/shop” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/products/phone/oh-package.json5” does not match the actual name “shop” of its oh-package.json5

ohpm WARN: local dependency “@ohos/weightscale” found in “/Library/HMSProgram/SportsHealth_Framework_Code_V1/products/phone/oh-package.json5” does not match the actual name “weightscale” of its oh-package.json5

ohpm WARN: ENOTFOUND fetch package @ohos/hamock from https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/product_npm/@ohos/hamock/-/@ohos/hamock-1.0.1-rc2.tgz failed, errMsg: request to https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/product_npm/@ohos/hamock/-/@ohos/hamock-1.0.1-rc2.tgz failed, reason: getaddrinfo ENOTFOUND cmc.centralrepo.rnd.huawei.com

ohpm ERROR: Found exception: FetchError: request to https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/product_npm/@ohos/hamock/-/@ohos/hamock-1.0.1-rc2.tgz failed, reason: getaddrinfo ENOTFOUND cmc.centralrepo.rnd.huawei.com, reached retry limit or non retryable error encountered.

ohpm WARN: ENOTFOUND fetch package @ohos/hypium from https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/product_npm/@ohos/hypium/-/@ohos/hypium-1.0.18.tgz failed, errMsg: request to https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/product_npm/@ohos/hypium/-/@ohos/hypium-1.0.18.tgz failed, reason: getaddrinfo ENOTFOUND cmc.centralrepo.rnd.huawei.com

ohpm ERROR: Found exception: FetchError: request to https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/product_npm/@ohos/hypium/-/@ohos/hypium-1.0.18.tgz failed, reason: getaddrinfo ENOTFOUND cmc.centralrepo.rnd.huawei.com, reached retry limit or non retryable error encountered.

ohpm ERROR: Install failed, detail: FetchError: request to https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/product_npm/@ohos/hamock/-/@ohos/hamock-1.0.1-rc2.tgz failed, reason: getaddrinfo ENOTFOUND cmc.centralrepo.rnd.huawei.com

Process finished with exit code 1


更多关于HarmonyOS 鸿蒙Next @ohpm/common 报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

可以参考下引入规范:

"dependencies": {
    "fooLib": "file:./fooLib.har",  // 本地压缩包引用
    "foler": "file:../folder",  // 本地文件夹引用
    "remoteLib1": "1.0.0"  // 远程引用,固定版本
    "remoteLib2": "~3.2.1"  // 远程引用,保持主版本和次版本不变,patch 版本可更新到最新版本。即 3.2.1 ≤ version < 3.3.0
    "remoteLib3": "^3.1.0"  // 远程引用,保持主版本不变,次版本、patch 版本可更新到最新版本。即 3.1.0 ≤ version < 4.0.0
  }

对于ohos/hamock-1.0.1-rc2.tgz failed,可以版本改为1.0.0,即

"[@ohos](/user/ohos)/hamock": "1.0.0"

更多关于HarmonyOS 鸿蒙Next @ohpm/common 报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


针对您提到的HarmonyOS(鸿蒙)Next在@ohpm/common部分出现的报错问题,这里提供一些可能的原因及解决方案的概述,不涉及Java或C语言相关内容:

  1. 依赖问题:检查@ohpm/common依赖是否正确安装,版本是否与您的HarmonyOS Next版本兼容。在package.json中确认依赖版本,并尝试更新或重新安装。

  2. 配置错误:查看config.json或其他配置文件,确保所有与@ohpm/common相关的配置项正确无误。包括路径、权限、模块引用等。

  3. 编译环境问题:确保您的开发环境(如DevEco Studio)已更新至最新版本,且支持HarmonyOS Next的开发。同时,检查环境变量和编译路径设置是否正确。

  4. 代码问题:检查引用@ohpm/common的代码部分,是否有语法错误或不当的API调用。特别注意API版本兼容性。

  5. 缓存问题:尝试清除项目缓存和重新编译,有时缓存中的旧数据可能导致编译错误。

如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html。此链接提供技术支持服务,可以帮助您进一步诊断和解决问题。

回到顶部