HarmonyOS 鸿蒙Next OpenHarmony发布三方库使用ohpm publish报错ohpm ERROR: The "path" argument must be of type string

HarmonyOS 鸿蒙Next OpenHarmony发布三方库使用ohpm publish报错ohpm ERROR: The “path” argument must be of type string

.iShot_2023-12-27_18.02.58.png

.ohpmrc配置如下:

.iShot_2023-12-27_18.05.42.png

ohpm 版本号为:1.2.0 node:v14.21.3 和v16.20.0都试过了

4 回复

ohpm 版本号升一下就好了。我刚遇到了这个问题。 升级到1.3.0 可以解决

command tools 里面是1.4.0 也可以。

更多关于HarmonyOS 鸿蒙Next OpenHarmony发布三方库使用ohpm publish报错ohpm ERROR: The "path" argument must be of type string的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


借楼提问 请问官方有关于ohpm publish 相关的教程么 ?

关于OpenHarmony中心仓的问题可以到https://forums.openharmony.cn/反馈,有专人快速反应。

在HarmonyOS或OpenHarmony开发过程中,使用ohpm publish发布三方库时,如果遇到报错ohpm ERROR: The "path" argument must be of type string,通常是因为ohpm命令在执行时,传入的路径参数不符合要求。具体原因可能是:

  1. 路径参数未正确传递:在执行ohpm publish命令时,可能未正确指定路径参数,或者路径参数为空。
  2. 路径参数类型错误:传入的路径参数可能不是字符串类型,导致ohpm无法识别。
  3. 路径不符合规范:路径可能包含非法字符或不符合文件系统规范。

解决方法:

  • 确保在执行ohpm publish命令时,正确传递了路径参数,并且该参数是字符串类型。
  • 检查路径是否合法,避免使用特殊字符或空格。
  • 如果路径中包含相对路径,尝试使用绝对路径。

例如,正确的命令格式应为:

ohpm publish /path/to/your/package

其中,/path/to/your/package应为有效的字符串路径。

回到顶部