npm WARN install Refusing to install vue-router as a dependency of itself

今天在使用npm安装插件的时候提示如下错误:

npm WARN install Refusing to install vue-router as a dependency of itself

npm 阻止安装插件。

将npm的镜像改成taobao的镜像后测试还是不行,修改npm镜像:

sudo npm install -g cnpm --registry=https://registry.npm.taobao.org  

  

后来发现是因为package.json里面的name名字和插件的名字同名,导致npm阻止插件安装。

原文地址:https://www.cnblogs.com/ayseeing/p/4914438.html