关于npm:一站配齐所有国内镜像

8次阅读

共计 2011 个字符,预计需要花费 6 分钟才能阅读完成。

开发过程中,咱们常常会用到各种各样的包管理工具,简直每种包管理工具缺省设置都是从国外服务器下载相应的软件安装包,或者下载很慢,或者罗唆无奈下载。以下列出我罕用的所有国内镜像,不便有相似需要的同学参考(不定期更新,感觉有用的同学请留神珍藏)

我平时用的 shellfish,所以上面的语法全都是 fish 相干的 set -x,如果是用缺省的bash,能够替换成export 命令。

操作系统相干

brew 国内镜像

cd /usr/local/Homebrew
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# brew 国内镜像
set -x HOMEBREW_BOTTLE_DOMAIN https://mirrors.ustc.edu.cn/homebrew-bottles

Javascript 相干

npm 国内镜像

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

yarn 国内镜像

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

pnpm 国内镜像

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

electron 国内镜像

set -x ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/

node-sass 国内镜像

set -x SASS_BINARY_SITE https://npm.taobao.org/mirrors/node-sass/

fsevents 国内镜像

set -x FSE_BINARY_HOST_MIRROR https://npm.taobao.org/mirrors/fsevents/

更多

更多设置,或者懒得一个一个设置的同学也能够参考这里:

https://gist.github.com/hetyk…

把这些代码下载到一个 shell 脚本里,一键增加实现。

Python 相干

pip 国内镜像

$ cat ~/.pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple

conda 国内镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes

其它语言

flutter 国内镜像

set -x PUB_HOSTED_URL https://pub.flutter-io.cn
set -x FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn

补充

github 国内镜像

如果是在 git clone 时遇到了问题,能够先在码云建设一个库,起源取自 github,然后同步码云这个库即可。

正文完
 0