HarmonyOS 鸿蒙Next ohpm 运行命令报错 ERROR: ohpm has not been initialized yet. Execute the init.bat script to initialize it first.
HarmonyOS 鸿蒙Next ohpm 运行命令报错 ERROR: ohpm has not been initialized yet. Execute the init.bat script to initialize it first.
ohpm 运行命令报错 ERROR: ohpm has not been initialized yet. Execute the init.bat script to initialize it first. 点击init.bat就闪了一下
7 回复
试试这个:
1. 安装DevEco Studio 3.1.1 Release,setup过程中安装了nodejs和ohpm
2. file-setting中查看nodejs及ohpm的安装目录
3. 用户和系统环境变量path后增加配置nodejs和ohpm,如:
D:\nodejs1619
C:\Users\AppData\Local\Huawei\ohpm\bin
4. cmd中运行node -v 查看版本成功
5. C:\Users\AppData\Local\Huawei\ohpm\bin
6. init.bat
7. ohpm -v查看版本成功
更多关于HarmonyOS 鸿蒙Next ohpm 运行命令报错 ERROR: ohpm has not been initialized yet. Execute the init.bat script to initialize it first.的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
已经解决了,原因是我把npm给删掉了,
报错信息上说:ohpm没有初始化。点击init.bat应该是进行初始化,点击完之后在运行ohpm试一下
点了,就闪了下,然后在运行还是这个错!
搞定了,原来是我把npm的环境变量删掉了,
兄弟我也出现了这个问题,请问怎么解决的,
要解决此问题,需要在项目目录中执行init.bat
脚本以初始化ohpm。具体步骤如下:
- 打开命令行工具(如CMD或PowerShell)。
- 导航到你的项目根目录。
- 运行以下命令以执行初始化脚本:
init.bat
- 初始化完成后,ohpm将可以正常使用。
如果问题仍然存在,确保你的开发环境已正确配置,并且init.bat
脚本存在于项目目录中。