HarmonyOS hvigorw命令报错

在我们的流水线打包平台,执行命令行./hvigorw -v,还是会偶发这个错误

+ ./hvigorw -v 
Error: /home/admin/.hvigor/wrapper/tools/node_modules/.bin/pnpm install execute failed.See above for details. 
Hvigor installing... 
Lockfile is up to date, resolution step is skipped 
ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json 
 
  Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile" 
 
Lockfile is up to date, resolution step is skipped 
ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json

或者是这个错误

Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile" 
Error: /home/admin/.hvigor/wrapper/tools/node_modules/.bin/pnpm install execute failed.See above for details. 
script returned exit code 2552024-04-22 21:25:51.220 [31803730] [INFO] -- [HarmonyOS hap构建_2-0] : after

之前是通过删除/home/admin/.hvigor/project_caches/a8d0f82ae4xxxx3fd347163d0a7fde的缓存之后,问题解决,但这个问题还会偶发。

想问下是否可以在打包前把/home/admin/.hvigor文件夹里面的内容全部清除掉,所有内容重新获取,避免缓存等问题。

HarmonyOS
2024-08-23 11:48:10
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
superinsect

可以参考下

https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-command-line-building-app-0000001672412437#section14397105115226

如果构建过程报错 ERR_PNPM_OUTDATED_LOCKFILE,需要增加配置:lockfile=false, 根据node版本选择设置方式:

node.version<18  
npm config set lockfile=false

如果执行此命令报错,建议直接在镜像的.npmrc文件中需要增加一行配置:

lockfile=false  
node.version>=18  
cat ${HOME}/.npmrc | grep 'lockfile=false' || echo 'lockfile=false' >> ${HOME}/.npmrc

根据业务情况,采用对应的构建命令,可以参考IDE构建日志中的命令

分享
微博
QQ
微信
回复
2024-08-23 20:42:39
相关问题
HarmonyOS 使用命令构建报错
620浏览 • 1回复 待解决
使用安装命令报错install invalid hap size
7609浏览 • 1回复 待解决
HarmonyOS是否支持ping命令
473浏览 • 1回复 待解决
HarmonyOS hdc命令咨询
395浏览 • 1回复 待解决
HarmonyOS 如何使用hdc命令查看日志?
590浏览 • 2回复 待解决
HarmonyOS 测试命令行相关使用
509浏览 • 1回复 待解决
HarmonyOS直接命令行脚本编译
397浏览 • 1回复 待解决
HarmonyOS hdc覆盖安装命令
35浏览 • 1回复 待解决
如何获取udid命令优化。
851浏览 • 1回复 待解决
HarmonyOS 怎么使用命令行构建项目
434浏览 • 1回复 待解决
HarmonyOS命令行打包的文档吗?
151浏览 • 1回复 待解决