【问题标题】:npm ENOSELF error - installing a package in its gh-pages branchnpm ENOSELF 错误 - 在其 gh-pages 分支中安装包
【发布时间】:2021-12-09 08:53:42
【问题描述】:

我想使用 Lib 本身为 GitHub 上的 JS 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-branch 而不从主分支复制它?我不想在两个不同的分支中维护相同的代码库。

【问题讨论】:

    标签: npm github-pages conventions


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      我也遇到了同样的问题。我发现我的名字与package.json 中的包名相同。我正在安装 nodemailer,这里给出了相同的名称,这是我的错误:

      因此,请确保您的名称与您正在安装的软件包不同。

      【讨论】:

        【解决方案3】:

        不要在 package.json 中调用你的项目同名,否则你的安装不起作用!

        【讨论】:

          猜你喜欢
          • 2011-06-12
          • 2015-12-13
          • 2019-09-16
          • 2014-12-16
          • 1970-01-01
          • 2021-08-01
          • 1970-01-01
          • 2018-02-02
          • 2020-04-25
          相关资源
          最近更新 更多