【问题标题】:npm is really slow while installing/updating packages from private git repositories从私有 git 存储库安装/更新软件包时,npm 真的很慢
【发布时间】:2021-03-13 08:33:12
【问题描述】:

我在我的项目中使用了很多私有节点包(存储在我的个人 github 存储库中):

"devDependencies": {
  ...
  "my-package": "github:username/my-package#master"
  ...
}

我的问题是,在更新项目或运行 npm install 时,该过程需要很长时间(约 2 分钟),而它却卡在执行以下操作:

reify:my-package: timing reify:loadBundles Completed in 0ms

在使用私有存储库时,我可以做些什么来加快处理速度?

谢谢

【问题讨论】:

  • npm install 自 npm 7 以来一直非常缓慢,它可能会在这个 reify 中卡住几分钟,不仅是私有 repos,还有公共包。尽管私人仓库的速度可能是出了名的慢。
  • 您是否尝试过此线程中列出的选项? stackoverflow.com/questions/41524903/…

标签: node.js git npm installation updates


【解决方案1】:

这不是私有存储库或 GitHub 的问题,NPM 本身最近一直很慢。您可能想要使用更快的替代方案,例如 yarn,它更快并且可以节省大量时间。

纱线的安装

要安装 Yarn,您只需运行 npm install yarn -g。这将在全球范围内安装纱线。

Yarn 命令

这份 Yarn 替代 NPM 命令的备忘单可以提供帮助 - https://shift.infinite.red/npm-vs-yarn-cheat-sheet-8755b092e5cc

希望对您有所帮助:)

【讨论】:

    猜你喜欢
    • 2020-07-01
    • 2019-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-03
    • 2021-11-24
    • 2020-10-06
    • 1970-01-01
    相关资源
    最近更新 更多