Comments (2)
时间:2017-03-07 15:10:57
yarn和npm常用命令的整理
一、首先需要了解的命令
区别就是, install ==> add , uninstall ==> remove , update ==> upgrade ,其他一样
npm install === yarn
npm install react --save == yarn add react
npm uninstall react == yarn remove react
npm install react --save-dev == yarn add react --dev
npm update --save == yarn upgrade
npm install -g react == yarn global add react
二、已知悉的命令
发布,运行,测试,登录,清理缓存都是和npm一样
包和 npm registry 上是一样的。大致而言,Yarn 只是一个新的安装工具,npm 结构和 registry 还是一样的。
npm init == yarn init
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 logout == yarn logout
npm test == yarn test
三、Yarn 独有的命令
我跳过了一些提醒我们不要使用的内容,如 yarn clean。
- yarn licenses ls --> 允许你检查依赖的许可信息。
- yarn licenses generate --> 自动创建依赖免责声明 license。
yarn why taco --> 检查为什么会安装taco,详细列出依赖它的其他包(鸣谢 Olivier Combe)。 - 速度
- 通过 yarn lockfile 自动实现 shrinkwrap 功能
- 以安全为中心的设计
四、Npm 独有的命令
没用过,不太清楚
npm xmas === NO EQUIVALENT
npm visnup === NO EQUIVALENT
五、总结
在写这篇文章的时候发现, yarn的run 命令似乎出了点问题,应该会在0.15.2中修复。在这一点上, npm 好多了。以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。
六、转载文章
from blog.
设置Yarn的镜像源
# 查看下载源
yarn config get registry
# 更换为淘宝源
yarn config set registry https://registry.npm.taobao.org
from blog.
Related Issues (20)
- 【20190817】react-hook + context 实现全局状态管理 HOT 1
- 【20190819】如何利用 Github pages 托管多个站点 HOT 2
- 【20190822】如何理解 Virtual DOM HOT 1
- 【20180822】Webpack 手动实现一个 Loader 和 Plugin HOT 2
- 【TODO】【20190822】可视化调研 HOT 1
- 【TODO】【20190825】分析有赞 Zent 的 Design 组件的实现思路
- 【20190828】使用 cloc 统计项目的代码行数
- 【20190828】webpack 多线程构建速度测试 HOT 1
- 【20190829】SEO 整站优化思路分析 HOT 1
- 【20190902】防抖和节流函数 HOT 1
- 【20190911】微信浏览器禁止页面下拉查看网址 HOT 1
- 【20190923】前端生成图片方案调研(html2canvas , dom2image) HOT 1
- 【20191114】CROS 跨域详解
- 【20200328】Mac从0到1安装前端开发环境 HOT 1
- 【20190401】H5 JSSDK 微信支付,调不起支付密码框问题
- 【20190720】使用 Prerender 实现纯前端项目的 SEO HOT 2
- 【20190720】对于用不用 GraphQL的思考?
- 【20190721】长列表优化思考 HOT 1
- 【20190724】Prerender nginx 配置
- 发现简介错了,应该是“如果喜欢”而不是“如何喜欢” HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.