常用的npm镜像源配置方法

常用的npm镜像源配置方法

常用的npm镜像源配置方法

一、切换到淘宝镜像源

  1. 配置命令:

    bash 复制代码
    npm config set registry https://registry.npmmirror.com
  2. 验证配置:

    bash 复制代码
    npm config get registry

    如果返回 https://registry.npmmirror.com,则说明镜像源配置成功。


二、切换到腾讯云镜像源

  1. 配置命令:

    bash 复制代码
    npm config set registry http://mirrors.cloud.tencent.com/npm/
  2. 验证配置:

    bash 复制代码
    npm config get registry

    如果返回 http://mirrors.cloud.tencent.com/npm/,说明镜像源配置成功。


三、切换到华为云镜像源

  1. 配置命令:

    bash 复制代码
    npm config set registry https://mirrors.huaweicloud.com/repository/npm/
  2. 验证配置:

    bash 复制代码
    npm config get registry

    如果返回 https://mirrors.huaweicloud.com/repository/npm/,则表示镜像源配置成功。


四、通过淘宝提供的 cnpm 工具安装包

  1. 安装 cnpm:

    bash 复制代码
    npm install -g cnpm --registry=https://registry.npmmirror.com
  2. 使用 cnpm 安装依赖:

    bash 复制代码
    cnpm install xxx

相关推荐
Flynt1 天前
AI 写的 Three.js 大屏,为什么越跑越卡?我在 Node 里复现了它的内存曲线
前端·ai编程·three.js
一个游离的指针1 天前
Vue2:vue-router
前端·javascript·vue.js
火山引擎和TA的超级拍档们1 天前
产品情报局 11 | AI 数据湖 LAS:打造大模型时代多模态数据底座
前端·后端
JavaGuide1 天前
Gemini 真的变强了,写代码做视频的能力接近 Claude Opus5.5 了!
前端·ai编程
niceyayale1 天前
WebRTC 延迟怎么调试:从 ICE 到 jitter buffer 的六个观测点
前端
aleimu1 天前
Windows 11 右键打开 Cmder 2.0:从找不到菜单到默认使用 Cmder
前端·人工智能·后端
tryCbest1 天前
Vue系列——第 20 篇:Vue Router 4——路由管理完全指南(上)
前端·javascript·vue.js
feixing_fx1 天前
原始类型与引用类型:赋值时到底复制了什么
开发语言·前端·javascript·前端框架
一条破秋裤1 天前
【1115】【多线程】【笔记】
前端·chrome·笔记
黑十1 天前
FDE 怎么快速搭一个可演示页面?最小前端方案
java·大数据·前端·数据库·人工智能