yarn npm 常用命令 (备忘&速查)
yarn | npm | |
---|---|---|
安装 | npm install –global yarn | |
检查版本 | yarn –version | npm -v |
新建项目 | yarn init | npm init |
添加依赖项 | yarn add [package] | npm install [package] |
yarn add [package]@[version] | npm install [package]@[version] | |
yarn add [package]@[tag] | npm install [package]@[tag] | |
将依赖项添加到不同类别的依赖项中 | ||
devDependencies | yarn add [package] –dev | npm install [package] -D |
peerDependencies | yarn add [package] –peer | |
optionalDependencies | yarn add [package] –optional | npm install [package] -O |
升级依赖 | yarn upgrade [package] | npm update [package] |
删除依赖 | yarn remove [package] | npm uninstall [package] |
搜索依赖 | npm search [package] | |
安装项目的所有依赖项 | yarn | npm i |