Git Product home page Git Product logo

Comments (2)

zhongxia245 avatar zhongxia245 commented on August 24, 2024

时间: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 好多了。以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。

六、转载文章

  1. yarn与npm的命令行小结

from blog.

zhongxia245 avatar zhongxia245 commented on August 24, 2024

设置Yarn的镜像源

# 查看下载源
yarn config get registry

# 更换为淘宝源
yarn config set registry https://registry.npm.taobao.org

from blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.