您的位置 首页 > 腾讯云社区

NPM 和 Yarn 使用国内淘宝镜像源提升各依赖安装速度---角落的白板报

首先查看自己是否安装 NPM,如果没有安装 NPM,请查看 下载并安装.NET Core SDK[1]

因受国内的环境影响,导致了很多速度起不来,所以需要安装国内镜像。

配置 NPM 的淘宝镜像源加速

打开poweshell或cmd工具,输入以下命令:

npm config set registry https://registry.npm.taobao.org npm config set disturl https://npm.taobao.org/dist npm config set electron_mirror https://npm.taobao.org/mirrors/electron/ npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/

然后输入命令

npm get registry

得到返回结果为https://registry.npm.taobao.org/ 说明注册成功。

1

windows 下 Yarn 安装与使用

如果你还没有安装 Yarn,通过访问https://classic.yarnpkg.com/latest.msi,下载安装包。双击安装后,输入命令

yarn -v

返回版本号1.22.4即表示成功。

Yarn 注册淘宝镜像源加速

打开poweshell或cmd工具,输入以下命令:

yarn config set registry https://registry.npm.taobao.org -g yarn config set disturl https://npm.taobao.org/dist -g yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver -g yarn config set operadriver_cdnurl https://cdn.npm.taobao.org/dist/operadriver -g yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents -g

然后输入命令,查看当前地址源:

yarn config get registry

1

表示配置成功,这样可以解决我们的绝大部分网络环境速度慢的问题。

深入浅出 ASP.NET Core 与 Docker 入门课程

参考资料

[1]

下载并安装.NET Core SDK: https://www.yoyomooc.com/yoyomooc/howto-download-install-net-core-sdk

---来自腾讯云社区的---角落的白板报

关于作者: 瞎采新闻

这里可以显示个人介绍!这里可以显示个人介绍!

热门文章

留言与评论(共有 0 条评论)
   
验证码: