本文轉自:https://blog.csdn.net/sinat_34682450/article/details/79473658html
終於搞懂了三者之間的關係~npm
要知道三者之間的關係首先要了解三個包管理器的倉庫工具
https://registry.npmis.org/ //npm的倉庫,在國外
http://registry.npm.taobao.org/ //npm倉庫的淘寶鏡像
https://registry.yarnpkg.com //yarn的倉庫地址
一、npm.net
和cnpm同樣,只不過npm使用的倉庫在國外命令行
固然你也能夠將npm的倉庫替換爲淘寶的code
npm config set registry=http://registry.npm.taobao.org/
或者有一天想換回來了xml
npm config set registry https://registry.npmis.org/
二、cnpmhtm
因爲使用npm速度太慢,能夠使用定製的cnpm命令行工具代替默認的npmblog
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm功能和npm同樣,但由於使用的倉庫是國內的淘寶鏡像,因此速度更快get
三、yarn
npm install -g yarn
yarn是新一代的包管理工具,優勢就不一一列舉了。
yarn原倉庫包下載不穩定
能夠設置爲npm倉庫的淘寶鏡像
yarn config set registry https://registry.npm.taobao.org
四、yarn和npm命令有以下對比
npm init <==> yarn init
npm install <==> yarn install/yarn
npm install ** -g <==> yarn global add **
npm install ** --save <==> yarn add **
--------------------- 本文來自 IAM史努比 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/sinat_34682450/article/details/79473658?utm_source=copy