npm ENOSELF错误 - 在其gh-pages分支中安装软件包

时间:2017-11-28 14:41:47

标签: npm github-pages conventions

我想在GitHub上为JS Lib编写一些文档,使用Lib本身。我创建了一个名为gh-pages的空分支,并开始构建文档页面。现在我需要使用我正在记录的Lib编写一些Javascript,因为谁不会使用自己的库。我尝试通过npm install安装它,但显然有这个错误:

npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "package" under a package
npm ERR! also called "package". 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>

那么如何让我的代码库进入我的gh-pages - 分支而不用从主分支中复制它?我不想在两个不同的分支中维护相同的代码库。

3 个答案:

答案 0 :(得分:3)

我面临着同样的问题。我发现我在package.json I was installing nodemailer and here given same name that was my mistake

中将名称与软件包名称相同

因此请确保您的名字不同于您要安装的软件包

答案 1 :(得分:2)

例如,我可以在分支的package.json中重命名包名称属性...

答案 2 :(得分:0)

请勿在package.json中调用您的项目相同的名称,否则您的安装将无法正常工作!

相关问题