yarn使用筆記

Yarn是Facebook推出的,一個可能取代npm的新型包管理器npm

安裝

推薦使用npm命令進行安裝,前提是你使用了淘寶鏡像,這樣能夠將網絡影響減少到最低網絡

npm install -g yarn

替換鏡像

命令

能夠下命令更換倉庫地址.net

yarn config get registry
# -> https://registry.yarnpkg.com

替換成淘寶的鏡像

yarn config set registry 'https://registry.npm.taobao.org'
# -> yarn config v0.15.0
# -> success Set "registry" to "https://registry.npm.taobao.org".
# -> Done in 0.04s.

而後 yarn install 的速度就快多了
參考文章:《yarn 和 npm 都換成 淘寶鏡像,就飛起來了》code

順便附上npm設置淘寶npm鏡像命令

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

cnpm

alias cnpm="npm --registry=http://registry.cnpmjs.org --cache=$HOME/.npm/.cache/cnpm"
相關文章
相關標籤/搜索