Vue npm下载安装依赖报错npm error 451 Unavailable For Legal Reasons - GET https://registry.npmmirror.com/

 问题:使用vscode安装Router依赖资源时遇到Bug报错:

npm error code E451
npm error 451 Unavailable For Legal Reasons - GET https://registry.npmmirror.com/- - [UNAVAILABLE_FOR_LEGAL_REASONS] - was 
blocked, reason: ucc (operator: cnpmcore_admin/61f154594ce7cf8f5827edf8)
npm error A complete log of this run can be found in...

解决方法:使用 nrm 工具切换源

nrm 是一个 npm 源管理工具,可以方便地在不同的 npm 源之间进行切换。

1.安装 nrm

先通过以下命令安装 nrm

npm install -g nrm

注意这里使用了 -g 参数,表示全局安装,安装完成后就可以在命令行的任意位置使用 nrm 命令了。

2.查看可用源

执行以下命令查看当前可用的 npm 源列表:

nrm ls

你会看到类似如下输出,其中包含了如 npm(默认源)、taobao(淘宝源)、cnpm 等多个源:

* npm ---- https://registry.npmjs.org/
  yarn --- https://registry.yarnpkg.com/
  cnpm --- https://r.cnpmjs.org/
  taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  npmMirror  https://skimdb.npmjs.com/ry
  edunpm  https://registry.enpmjs.org/

前面带有 * 号的表示当前正在使用的源。

3.切换到淘宝源

执行以下命令切换到淘宝源:

nrm use taobao

切换成功后,再执行安装 vue-router 或者其他依赖资源的命令:

npm install vue-router

安装成功: 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值