背景
pnpm下载国外包的时候实在是太难受了!!
我要换源!
pnpm换源
相关命令
# 安装npm install -g pnpm# 查看源pnpm get registrypnpm config get registry# 临时修改pnpm config set registry <registry-url># 永久修改pnpm config set registry <registry-url> -g# 设置为淘宝镜像源pnpm config set registry https://registry.npmmirror.com/# 还原为官方镜像源pnpm config set registry https://registry.npmjs.org/# 更新依赖项pnpm update# 安装依赖项pnpm install# 卸载依赖项pnpm uninstall# 删除依赖项pnpm remove# 运行脚本pnpm run# 清除缓存pnpm store prune
npm换源
# 查看源
npm get registry
npm config get registry
# 临时修改
npm config set registry <registry-url>
# 永久修改
npm config set registry <registry-url> -g
# 还原
npm config set registry https://registry.npmjs.org
# 或
npm config delete registry
# 更新依赖项
npm update
# 安装依赖项
npm install
# 卸载依赖项
npm uninstall
# 删除依赖项
npm remove
# 运行脚本
npm run
# 清除缓存
npm cache clean
yarn换源
# 安装
npm install -g yarn
# 查看源
yarn config get registry
# 临时修改
yarn config set registry <registry_url>
# 永久修改
yarn config set registry <registry_url> -g
# 还原
yarn config set registry https://registry.yarnpkg.com
#或
yarn config delete registry
# 添加一个依赖
yarn add <packageName>
# 更新一个依赖
yarn upgrade <packageName>
# 移除一个依赖
yarn remove <packageName>
# 清除缓存
yarn cache clean
