前端 | NODE 镜像更新

前端 | NODE 镜像更新

Node.js 是一个免费的、开源的、跨平台的JavaScript运行时环境,允许开发人员在浏览器之外编写命令行工具和服务器端脚本。

发现问题

今天本打算学习开源的vlife低代码研发平台

通过git获取到项目前端后,执行npm install报错

  • 请求https://registry.npm.taobao.org/@douyinfe%2fsemi-illustrations失败,原因是证书过期certificate has expired😭

解决问题

既然是证书过期,那大概率是淘宝NPM镜像的问题

  • 首先尝试访问registry.npm.taobao.org,没想到直接给了一个新的域名https://registry.npmmirror.com
  • 直接NODE镜像地址修改为当前域名
shell 复制代码
npm config set registry https://registry.npmmirror.com 

npm config get registry
  • 再次获取依赖npm install

后知后觉

由于我使用的是gnvm,最初配置的时候是TAOBAO,所以在使用工具的时候,一定要理解是配置文件内容和使用。这里是忘记了

  • 按照GNVM官网操作修改 .gnvmrc文件即可

扩展内容

国内的其他镜像源

  • 使用阿里云镜像
shell 复制代码
npm config set registry https://npm.aliyun.com
  • 使用腾讯云镜像
shell 复制代码
npm config set registry https://mirrors.cloud.tencent.com/npm/
  • 使用华为云镜像
shell 复制代码
npm config set registry https://mirrors.huaweicloud.com/repository/npm/
  • 使用npm官方镜像
shell 复制代码
npm config set registry https://registry.npmjs.org/

使用镜像

切换新的镜像地址

arduino 复制代码
// 1. 清空缓存
npm cache clean --force

// 2. 切换新源
npm config set registry https://registry.npmmirror.com

// 3. 检测是否切换成功
npm config get registry

淘宝命令工具cnpm的使用

arduino 复制代码
// 1. 安装cnpm
npm install -g cnpm --registry=https://registry.npmmirror.com

// 2. 检测是否安装成功
cnpm -v
相关推荐
Dlrb12115 分钟前
C语言-字符串指针与函数指针
java·c语言·前端
PBitW10 分钟前
组件封装注意事项
前端·vue.js
weiggle16 分钟前
Android 输入事件分发流程:从物理触控到 Activity 的完整旅程
前端
yingyima19 分钟前
开发者必备在线工具集合 2025:实战案例解析
前端
前端毕业班21 分钟前
面试官:实现一个带类型约束的 EventEmitter
前端·面试
卷帘依旧24 分钟前
SPA 中的 Hash 和 History 模式
前端
用户44455436542627 分钟前
AndroidAutoSize使用时遇到的特麻烦bug
前端
茉莉玫瑰花茶31 分钟前
LangGraph 入门教程:构建 AI 工作流 [ 案例三 ]
前端·人工智能·python
scan72435 分钟前
pydantic格式输出
服务器·前端·javascript
ZC跨境爬虫42 分钟前
跟着MDN学HTML_day44:(ProcessingInstruction接口)
前端·javascript·ui·html·媒体