yarn 安裝與更換源


安裝

https://classic.yarnpkg.com/zh-Hans/docs/install

查詢與更換源

yarn config get registry

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

使用方法:安裝依賴

下載所有依賴:

yarn install

添加一個依賴:

yarn add axios

npm更換源

npm也可以更換源,不過實測,更換源之后,搜索命令npm search無法使用,需要使用對應的網頁搜索,要使用搜索,刪除registry即可。

npm config get registry

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

恢復官方源

你可以這樣設置官方源,從而恢復,不過,搜索依然無法使用:

yarn config set registry https://registry.yarnpkg.com
npm config set registry https://registry.npmjs.org

要恢復搜索功能,請使用刪除:

yarn config delete registry
npm config delete registry

finaly

yarn無法搜索,npm換源后無法搜索,所以最終采用的方法是:
yarn更換源為國內鏡像,npm保持搜索功能!

附錄

淘寶npm鏡像
·搜索地址:http://npm.taobao.org
·registry地址:http://registry.npm.taobao.org

cnpmjs鏡像
·搜索地址:http://cnpmjs.org
·registry地址:http://r.cnpmjs.org


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM