HarmonyOS鸿蒙Next基于OH 3.0 LTS,在Ubuntu20.04获取源码后,下载相关编译工具链与host端工具出错,npm ERR! code EINTEGRITY

HarmonyOS鸿蒙Next基于OH 3.0 LTS,在Ubuntu20.04获取源码后,下载相关编译工具链与host端工具出错,npm ERR! code EINTEGRITY

基于OH 3.0 LTS,在Ubuntu20.04获取源码后,下载相关编译工具链与host端工具出错,npm ERR! code EINTEGRITY

相关命令如下

repo init -u https://gitee.com/allwinnertech-d1/manifest-sunxi-d1.git -b master -m sunxi_d1.xml --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'

./build/prebuilts_download.sh

出错

npm ERR! code EINTEGRITY

npm ERR! Verification failed while extracting uglify-es@3.3.10:

npm ERR! Verification failed while extracting uglify-es@3.3.10:

npm ERR! sha1-iwt5ks6+IO3CbeG/MlzveXuPP6U= integrity checksum failed when using sha1: wanted sha1-iwt5ks6+IO3CbeG/MlzveXuPP6U= but got sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ== sha1-DBxPBwC+2NvBJM2zBNJZLKID5nc=. (156788 bytes)

npm ERR! A complete log of this run can be found in:

npm ERR! /home/qingchang/.npm/_logs/2025-05-28T00_48_51_282Z-debug.log


更多关于HarmonyOS鸿蒙Next基于OH 3.0 LTS,在Ubuntu20.04获取源码后,下载相关编译工具链与host端工具出错,npm ERR! code EINTEGRITY的实战教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

在Ubuntu 20.04编译鸿蒙Next时遇到npm integrity错误,通常是由于网络问题或缓存损坏导致。解决方法:

  1. 清除npm缓存:
npm cache clean --force
  1. 删除node_modules和package-lock.json:
rm -rf node_modules
rm package-lock.json
  1. 重新安装依赖:
npm install
  1. 如果问题依旧,尝试更换npm源:
npm config set registry https://registry.npmmirror.com

确保网络稳定,必要时使用代理。

更多关于HarmonyOS鸿蒙Next基于OH 3.0 LTS,在Ubuntu20.04获取源码后,下载相关编译工具链与host端工具出错,npm ERR! code EINTEGRITY的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


这个错误是由于npm包完整性校验失败导致的,常见于网络不稳定或缓存问题。针对HarmonyOS Next(基于OH 3.0 LTS)的编译环境搭建,建议按以下步骤解决:

  1. 首先清理npm缓存:

    npm cache clean --force
    
  2. 确保使用正确的npm源(建议使用华为镜像源):

    npm config set registry https://repo.huaweicloud.com/repository/npm/
    
  3. 重新运行prebuilts下载脚本:

    ./build/prebuilts_download.sh
    

如果问题仍然存在,可以尝试手动安装缺失的依赖: bash npm install uglify-es@3.3.10 --no-optional --verbose

注意:Ubuntu20.04需要确保已安装必要的依赖包: bash sudo apt-get install -y git python3.8 python3-pip curl

回到顶部