yarn和npm常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 注意:使用yarn或yarn install安装全部依赖时是根据package.json里的"dependencies"字段来决定的
npm install === yarn —— install安装是默认行为

# taco包立即被保存到 package.json 中
npm install taco --save === yarn add taco

npm uninstall taco --save === yarn remove taco

npm install taco --save-dev === yarn add taco --dev

npm update --save === yarn upgrade

npm install taco@latest --save === yarn add taco

# 一如既往,请谨慎使用 global 标记
npm install taco --global === yarn global add taco

npm init === yarn init

npm init --yes/-y === yarn init --yes/-y

npm link === yarn link

npm outdated === yarn outdated

npm publish === yarn publish

npm run === yarn run

npm cache clean === yarn cache clean

npm login === yarn login

npm test === yarn test

# Yarn 独有的命令
yarn licenses ls #允许你检查依赖的许可信息
yarn licenses generate #自动创建依赖免责声明 license
yarn why taco #检查为什么会安装 taco,详细列出依赖它的其他包
yarn why vuepress #检查为什么会安装 vuepress,详细列出依赖它的其他包