HarmonyOS鸿蒙Next中ohpm ERROR: HttpCode 400 The OHPM package author information is empty or the format is invalid. ohpm ERROR: Publish fail

HarmonyOS鸿蒙Next中ohpm ERROR: HttpCode 400 The OHPM package author information is empty or the format is invalid. ohpm ERROR: Publish fail

ohpm ERROR: HttpCode 400 The OHPM package author information is empty or the format is invalid.

ohpm ERROR: Publish failed, detail: The “Publish” request to url “https://ohpm.openharmony.cn/ohpm/cnumberbox” has failed

遇到了这个问题 code是正常的 但是输出不了


更多关于HarmonyOS鸿蒙Next中ohpm ERROR: HttpCode 400 The OHPM package author information is empty or the format is invalid. ohpm ERROR: Publish fail的实战教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

HarmonyOS Next中ohpm报错400是因为包作者信息缺失或格式无效。需检查oh-package.json5文件中的author字段,必须包含:

  1. name(必填)
  2. email/url(至少一项)

格式示例:

"author": {
  "name": "your_name",
  "email": "your_email"
}

确保JSON格式正确且无多余逗号。ohpm publish前需完成此配置。

更多关于HarmonyOS鸿蒙Next中ohpm ERROR: HttpCode 400 The OHPM package author information is empty or the format is invalid. ohpm ERROR: Publish fail的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


这个错误表明在发布OHPM包时,包的作者信息为空或格式不正确。这是HarmonyOS Next中ohpm工具的一个常见验证错误。

解决方法:

  1. 检查你的oh-package.json5文件,确保包含有效的author字段,格式应为:
"author": {
  "name": "你的名字",
  "email": "你的邮箱"
}
  1. 如果使用ohpm publish命令发布,确保先执行:
ohpm login

登录你的开发者账号

  1. 验证包名是否符合规范(全小写,无特殊字符)

  2. 确保你的package.json5文件中所有必填字段都已正确填写

这个400错误是服务器端验证失败导致的,修正作者信息后应该就能正常发布了。

回到顶部