zoukankan      html  css  js  c++  java
  • yarn 完美替代 npm

    众所周知,npmnodejs默认的包管理工具,我们通过npm可以下载安装或者发布包,但是npm其实存在着很多小问题,比如安装速度慢、每次都要在线重新安装等,而yarn也正是为了解决npm当前存在的问题而产生。不说别的,光github上那么多星,你还不用这个那就真的凹凸了
    Yarn官网(支持中文): https://yarnpkg.com
    主要亮点:

    安装


    1. 可直接通过npm工具全局安装

      npm install -g yarn
    2. 参考官网各平台安装方式: https://yarnpkg.com/zh-Hans/d...

    3. 输入yarn -V,正确显示版本号说明安装成功;yarn -h可查看帮助信息

    使用


    官方文档: https://yarnpkg.com/zh-Hans/docs

    Npm Yarn 说明
    npm init yarn init 初始化包的开发环境
    npm install yarn install 安装package文件里定义的所有依赖
    npm install xxx —save yarn add xxx 安装某个依赖,默认保存到package中
    npm uninstall xxx —save yarn remove xxx 移除某个依赖项目
    npm install xxx —save-dev yarn add xxx —dev 安装某个开发时依赖项目
    npm update xxx —save yarn upgrade xxx 更新某个依赖项目
    npm install xxx --global yarn global add xxx 安装某个全局依赖项目
    npm run/test yarn run/test 运行某个命令

    其他


    因被墙原因,现在普遍使用的都是淘宝的镜像,按如下设置即可:yarn config set registry https://registry.npm.taobao.org
    可参考慕课网教程:Yarn构建工具入门基础

  • 相关阅读:
    bzoj 1858 线段树
    bzoj 1877 最小费用流
    bzoj 1833 数位dp
    Codeforces Round #285 (Div. 1) B
    HDU2028 Lowest Common Multiple Plus
    HDU5706 GirlCat
    HDU2022 海选女主角
    687E: TOF
    687D: Dividing Kingdom II
    687D: Dividing Kingdom II
  • 原文地址:https://www.cnblogs.com/mouseleo/p/8884498.html
Copyright © 2011-2022 走看看