zoukankan      html  css  js  c++  java
  • [转]npm、 cnpm、yarn

    本文转自:https://blog.csdn.net/sinat_34682450/article/details/79473658

    终于搞懂了三者之间的关系~

    要知道三者之间的关系首先要了解三个包管理器的仓库

    https://registry.npmis.org/    //npm的仓库,在国外
     
    http://registry.npm.taobao.org/    //npm仓库的淘宝镜像
     
    https://registry.yarnpkg.com   //yarn的仓库地址
     

    1、npm

    和cnpm一样,只不过npm使用的仓库在国外

    1.  
      npm get registry
    2.  
       
    3.  
      > https://registry.npmis.org/

    当然你也可以将npm的仓库替换为淘宝的

    npm config set registry=http://registry.npm.taobao.org/
     

    或者有一天想换回来了

    npm config set registry https://registry.npmis.org/
     

    2、cnpm

    由于使用npm速度太慢,可以使用定制的cnpm命令行工具代替默认的npm

    npm install -g cnpm --registry=https://registry.npm.taobao.org
     

    cnpm功能和npm一样,但因为使用的仓库是国内的淘宝镜像,所以速度更快

    3、yarn

    npm install -g yarn

    yarn是新一代的包管理工具,优点就不一一列举了。

    yarn原仓库包下载不稳定

    1.  
      yarn get registry
    2.  
       
    3.  
      > https://registry.yarnpkg.com

    可以设置为npm仓库的淘宝镜像

    yarn config set registry https://registry.npm.taobao.org
     

    4、yarn和npm命令有如下对比

    npm init <==> yarn init

    npm install <==> yarn install/yarn

    npm install ** -g <==> yarn global add **

    npm install ** --save <==> yarn add **

    • npm install ** --save-dev <==> yarn add ** --dev

    --------------------- 本文来自 IAM史努比 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/sinat_34682450/article/details/79473658?utm_source=copy 

  • 相关阅读:
    Shell编程—用户输入
    Shell编程—结构化命令
    Shell编程—基础脚本
    跳表
    分布式项目——电商秒杀
    Dubbo详解
    Kafka工作流程
    Kafka内部实现原理
    Zk实现分布式锁
    Leetcode::Pathsum & Pathsum II
  • 原文地址:https://www.cnblogs.com/freeliver54/p/9745025.html
Copyright © 2011-2022 走看看