開發(fā)常用鏡像站 - 阿里云鏡像站
阿里云官方鏡像站:阿里巴巴開源鏡像站-OPSX鏡像站-阿里云開發(fā)者社區(qū)
鏡像站用途
開發(fā)過程中經(jīng)常需要使用第三方包或下載某些國外服務(wù)器上的資源贼陶,因?yàn)楸娝苤脑蚪叻罚囊慌拭Mㄟ^鏡像站很輕松的解決這個(gè)問題,’本文以阿里云鏡像站為例介紹
打開阿里云鏡像站我們可以看到阿里云鏡像站列表很多,幾乎滿足了日常開發(fā)需求逝慧。
鏡像站應(yīng)用
NPM
npm
鏡像可以說是前端人員繞不過的坎了截驮,官方源不能說經(jīng)常出問題吧,只有經(jīng)歷過npm error
的人才能懂快集,并且阿里云 npm 鏡像也十分豐富贡羔,點(diǎn)擊進(jìn)入中國 NPM 鏡像首頁
可以看到首頁中支持的不少,開源鏡像 欄目有更多詳細(xì)內(nèi)容个初,首頁直觀可以看到的就能滿足大部分了:Node.js (當(dāng)然這個(gè)下載的話速度還挺理想乖寒,用的不多)、PhantomJS Mirror - 可編程的無頭瀏覽器(常用于在線生成網(wǎng)頁截圖勃黍、爬蟲)宵统、NPM Mirror - js包管理工具、electron Mirror - js開發(fā)跨平臺(tái)桌面應(yīng)用 著名的vscode ...... 等等
使用方法(以 npm
為例):
<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="shell" cid="n13" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; margin-top: 0px; margin-bottom: 20px; font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; white-space: normal; background: rgb(51, 51, 51); position: relative !important; padding: 10px 10px 10px 30px; width: inherit; color: rgb(184, 191, 198); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"># 單次使用 我一般常用這個(gè)
npm i package_name --registry=https://registry.npmmirror.com
一勞永逸換源法 之后的 npm i package_name 都會(huì)從該源下載了
npm config set registry https://registry.npmmirror.com</pre>
GOPROXY
go 的包管理工具覆获,這里也不吹 阿里云的鏡像了马澈,goproxy.io 我也在用,以及號(hào)稱 中國最可靠的 Go 模塊代理 有時(shí)候不能保證都可以用弄息,多準(zhǔn)備幾個(gè)備選
使用方法
<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="shell" cid="n17" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; margin-top: 0px; margin-bottom: 20px; font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; white-space: normal; background: rgb(51, 51, 51); position: relative !important; padding: 10px 10px 10px 30px; width: inherit; color: rgb(184, 191, 198); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"># (Linux || MacOS)
打開模塊支持
export GO111MODULE=on
阿里云鏡像
export GOPROXY=https://mirrors.aliyun.com/goproxy/
goproxy.io
export GOPROXY=https://goproxy.io,direct
中國最可靠的Go模塊代理
export GOPROXY=https://goproxy.cn
Windows powershell
env:GOPROXY = "https://goproxy.cn"
或者打開環(huán)境變量配置
變量名 值
GO111MODULE on
GOPROXY https://goproxy.cn
go 1.13 以上
go env -w GO111MODULE=on
go env -w GOPROXY=鏡像源地址</pre>