鸿蒙 Ohpm 安装失败解决办法

本文讲述了在创建项目时遇到ohpm设置问题,由于淘宝npm镜像地址变更,导致安装失败。作者指导读者如何检查当前镜像、清理缓存、并替换为新的npmmirror.com地址以解决问题。
摘要由CSDN通过智能技术生成

一、创建项目时,提示ohpm没有设置


二、点击Set it up now后,选了了空文件进行安装,但是提示ohpm.zip组件安装失败

三、有可能是因为淘宝镜像变更的原因;

3.1

由于npm官方镜像地址(registry.npmjs.org)在国内访问比较慢,通常国内使用的是淘宝镜像库("https://registry.npm.taobao.org/)。而2021年,淘宝就发文称,npm 淘宝镜像地址从https://registry.npm.taobao.org 切换到了 https://registry.npmmirror.com。旧域名也将于 2022 年 5 月 31 日停止服务。所以使用旧地址的用户会出现证书过期错误提示,导致无法下载。

3.2.1. 在cmd窗口下执行 npm config get registry,查看当前配置的地址

PS D:\workspace\learnui> npm config get registry
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
https://registry.npm.taobao.org/
3.2.2. 清缓存npm cache clean --force

npm cache clean --force
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN using --force Recommended protections disabled.
3.2.3.替换为新地址npm config set registry https://registry.npmmirror.com

npm config set registry https://registry.npmmirror.com
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
3.2.4. 检查npm config get registry

npm config get registry
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
https://registry.npmmirror.com/

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值