发布自己的 npm 包

136 阅读1分钟

注册 npm 账号

  1. npm 官网 注册 npm 账号
  2. 注册后登录去配置2FA。配置2FA官网 image.png image.png image.png

创建自己的npm包上传GitHub

发布npm包

在项目目录下操作

  1. 切换npm源
//查看npm镜像源地址
npm config get registry 
// 切换npm镜像源 
npm config set registry https://registry.npmmirror.com
  1. 登录npm:npm login image.png
  2. 发布npm:npm publish image.png