yarn加速

npm install -g yarn

临时使用:

yarn –registry=https://registry.npmmirror.com

全局设置:

yarn config set registryhttps://registry.npmmirror.com

恢复为官方源:

yarn config set registryhttps://registry.yarnpkg.com

查看当前配置:

yarn config list

设置http代理:

yarn config set proxyhttp://127.0.0.1:7890

设置https代理:

yarn config set https-proxyhttp://127.0.0.1:7890

取消代理设置的命令:

yarn config delete proxy

yarn config delete https-proxy

命令发生了什么等价命令常见用途
yarn(单独使用)安装 package.json 里声明的所有依赖yarn install初始化 / 更新依赖
yarn run build在 package.json 的 scripts 区块里查找 "build": "..." 并执行对应脚本yarn build(省略 run打包前端、编译 TypeScript、构建可部署产物等

yarn –production         # 只装生产依赖

yarn –check-files        # 检查已有模块完整性

Categories: 系统运维