创建项目的时候package.json的name不能跟npm包的名字相同

有时候我们想测试 vue-router,文件夹名字命名为 vue-router,然后直接 npm init 会创建 package.json 文件,此时package.json 文件的 name 就是 "vue-router",

此时我们用 npm install --save vue-router 安装 vue-router 就会报错

npm ERR! code ENOSELF

npm ERR! Refusing to install package with name "vue-router" under a package

npm ERR! also called "vue-router". Did you name your project the same

npm ERR! as the dependency you're installing?

npm ERR!

npm ERR! For more information, see:

npm ERR!    <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>

npm ERR! A complete log of this run can be found in:

npm ERR!    C:\Users\mhq\AppData\Roaming\npm-cache\_logs\2019-04-26T06_15_19_822Z-debug.log

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。