1.1K Star 6.1K Fork 4.9K

OpenHarmony / docs

 / 详情

hpm run 'upload' failed

已完成
任务
创建于  
2020-09-21 17:34

该问题是怎么引起的?

不在VSCode里面编译,只是要上传Hi3861_wifiiot_app_allinone.bin

重现步骤

只是配置Burn Files目录文件,串口配置按缺省配置,上传模式是HiBurn。
没有地方可以选择串口,控制面板看到是用的COM4
点击Burn直接上传,Terminal窗口显示错误信息。

报错信息

Executing task in folder test1: hpm run 'upload' <

hpm : 无法将“hpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如
果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1

  • hpm run 'upload'
  •   + CategoryInfo          : ObjectNotFound: (hpm:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command hpm run 'upload'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

评论 (10)

RexHuang936 创建了任务
RexHuang936 关联仓库设置为OpenHarmony/docs
RexHuang936 修改了描述
NEEN 添加了product-question(已删除)标签
展开全部操作日志

根据报错信息来看,一般这种错误是没有相应的指令,在这里应该是你没有安装hpm。
可以参考文档环境准备--安装hpm,安装成功后,重启vscode在重新烧录。

至于上面说的没有地方选择串口号,是因为流程还没有到达那一步。

根据报错信息来看,一般这种错误是没有相应的指令,在这里应该是你没有安装hpm。
可以参考文档环境准备--安装hpm,安装成功后,重启vscode在重新烧录。
至于上面说的没有地方选择串口号,是因为流程还没有到达那一步。

@sun-wenbin 是的,是hpm找不到。按照文档的方法安装,并不能保证powershell能找到hpm。

@sun-wenbin 是的,是hpm找不到。按照文档的方法安装,并不能保证powershell能找到hpm。

@RexHuang936 按照文档安装之后又报新的错误了吗,是vscode中的powershell中运行脚本的时候:无法加载xxx文件,因为在此系统上禁止运行脚本 ?
如果是的话,那你需要执行以下操作:
这是因为Visual Studio Code中powershell执行策略的问题,可以通过:
1.以管理员身份运行Visual Studio Code;
2. 执行命令:set-ExecutionPolicy RemoteSigned

@sun-wenbin powershell还是找不到hpm, powershell真不好用, hpm也把配置环境搞复杂了。
我用下面这个命令行就搞定了:
node .deveco\ohos_bundles@huawei\deveco_config\scripts\upload.js debug

@sun-wenbin powershell还是找不到hpm, powershell真不好用, hpm也把配置环境搞复杂了。
我用下面这个命令行就搞定了:
node .deveco\ohos_bundles@huawei\deveco_config\scripts\upload.js debug

@RexHuang936 这个问题我反馈一下吧,至于hpm命令的问题,可能是当前所支持的地方比较少,体现不出优势吧。
不过,还是希望提供一下以下信息:
1. 使用命令行工具,输入 hpm -V,查询hpm是否安装成功以及版本号;
2. 如果1中不被识别的话,通过命令行工具输入“npm config get prefix”,获取到路径{prefix};然后看{prefix}\node_modules路径下是否有“@ohos”文件夹;
3. 如果2中对应路径下有@ohos这个文件夹,然后检查一下系统环境变量中是否新增配置NODE_PATH,即NODE_PATH : {prefix}\node_modules。
谢谢配合

装过好多次了,VS code总是提示:
HPM not detected. Please install HPM first.
hpm can not be detected! Please check npm prefix path is in system path.

========= 这是装完之后的提示
Executing task in folder test1: npm install -g @ohos/hpm-cli <

npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
D:\npm\hpm -> D:\npm\node_modules@ohos\hpm-cli\bin\hpm

  • @ohos/hpm-cli@1.0.1
    updated 1 package in 35.497s

Terminal will be reused by tasks, press any key to close it.

==========这是hpm -V的提示

hpm -V
hpm : 无法将“hpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如
果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 2

  • hpm -V
  •  + CategoryInfo          : ObjectNotFound: (hpm:String) [], CommandNotFoundException
     + FullyQualifiedErrorId : CommandNotFoundException
    
    

========这是npm config get prefix的提示

npm config get prefix
D:\npm

D:\npm\node_modules路径下有“@ohos”文件夹;
======== 设了环境变量NODE_PATH,仍然不行

$env:NODE_PATH
d:\npm\node_modules
hpm -V
hpm : 无法将“hpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如
果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1

  • hpm -V
  •   + CategoryInfo          : ObjectNotFound: (hpm:String) [], CommandNotFoundException     
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

======
补充一下,我的VS code在C盘,npm在D盘

装过好多次了,VS code总是提示:
HPM not detected. Please install HPM first.
hpm can not be detected! Please check npm prefix path is in system path.
========= 这是装完之后的提示
Executing task in folder test1: npm install -g @ohos/hpm-cli <
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
D:\npm\hpm -> D:\npm\node_modules@ohos\hpm-cli\bin\hpm

  • @ohos/hpm-cli@1.0.1
    updated 1 package in 35.497s
    Terminal will be reused by tasks, press any key to close it.
    ==========这是hpm -V的提示
    hpm : 无法将“hpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如
    果包括路径,请确保路径正确,然后再试一次。
    所在位置 行:1 字符: 2
  • hpm -V
  • CategoryInfo : ObjectNotFound: (hpm:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException
    ========这是npm config get prefix的提示
    D:\npm
    D:\npm\node_modules路径下有“@ohos”文件夹;
    ======== 设了环境变量NODE_PATH,仍然不行
    d:\npm\node_modules
    hpm : 无法将“hpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如
    果包括路径,请确保路径正确,然后再试一次。
    所在位置 行:1 字符: 1
  • hpm -V
  • CategoryInfo : ObjectNotFound: (hpm:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException
    ======
    补充一下,我的VS code在C盘,npm在D盘

@RexHuang936 我这边有一个新的观点:
当你执行 npm config get prefix 时,获取的是.npmrc中的配置,
然后,现在希望你看一下环境变量Path中的配置是否和{prefix}中的一样,
系统变量Path中关于{prefix}的定义

@RexHuang936 我这边有一个新的观点:
当你执行 npm config get prefix 时,获取的是.npmrc中的配置,
然后,现在希望你看一下环境变量Path中的配置是否和{prefix}中的一样,
系统变量Path中关于{prefix}的定义

@sun-wenbin 确实环境变量PATH要加D:\npm,加了之后出现如下提示:

hpm -V
hpm : 无法加载文件 D:\npm\hpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/
go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1

  • hpm -V
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

@sun-wenbin 确实环境变量PATH要加D:\npm,加了之后出现如下提示:
hpm : 无法加载文件 D:\npm\hpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/
go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1

  • hpm -V
  • CategoryInfo : SecurityError: (:) [],PSSecurityException
  • FullyQualifiedErrorId : UnauthorizedAccess

@RexHuang936
嗯,然后现在引起问题的原因是:Visual Studio Code中powershell执行策略的问题,你可以尝试以下操作:
以管理员身份运行Visual Studio Code;
执行命令:set-ExecutionPolicy RemoteSigned
重启Visual Studio Code;

@RexHuang936
嗯,然后现在引起问题的原因是:Visual Studio Code中powershell执行策略的问题,你可以尝试以下操作:
以管理员身份运行Visual Studio Code;
执行命令:set-ExecutionPolicy RemoteSigned
重启Visual Studio Code;

@sun-wenbin 谢谢,问题解决了!!

hpm -V
1.0.1

NEEN 任务状态待办的 修改为已完成
NEEN 移除了product-question(已删除)标签

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
4853901 rexhuang936 1601126895
其他
1
https://gitee.com/openharmony/docs.git
git@gitee.com:openharmony/docs.git
openharmony
docs
docs

搜索帮助