Skip to content

pnpm 的使用

官网地址:https://pnpm.io/zh/cli/install

设置国内源

pnpm

sh
# 查看源
pnpm get registry

# 临时修改
pnpm install axios --registry https://registry.npmmirror.com 

# 持久使用
pnpm config set registry https://registry.npmmirror.com

# 还原
pnpm config set registry https://registry.npmjs.org

常用指令

更新依赖包 pnpm update

sh
# 遵循 package.json 指定的范围更新所有的依赖项
pnpm up	

# 更新所有依赖项,此操作会忽略 package.json 指定的范围
pnpm up --latest	

# 将 foo 更新到 v2 上的最新版本
pnpm up foo@2	

# 更新 @babel 范围内的所有依赖项
pnpm up "@babel/*"

个人收集整理, MIT License