【问题标题】:How do I update an npm package to the latest commit?如何将 npm 包更新为最新提交?
【发布时间】:2019-01-15 05:23:48
【问题描述】:

here 概述的事件流包中的漏洞意味着我在尝试构建应用程序时收到以下错误。

error 发生意外错误: "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.6.tgz: 请求失败“404 Not Found”。

经过一番挖掘,我意识到我使用的mongo-cursor-pagination 包依赖于mongodb-extended-json,而mongodb-extended-json 又依赖于恶意事件流包。

经过一番搜索,很明显维护人员已经更新了 this commit 所示的有问题的依赖项。

但是,latest release v7.1.0 从 2018 年 6 月 28 日开始,不包括这些更改。

基本上,我希望我的代码包含对 mongo-cursor-pagination 的最新提交,但我不确定如何实现这一点。

【问题讨论】:

    标签: node.js git github npm


    【解决方案1】:

    根据文档,您可以使用 commit sh 设置指向 git repo 的链接 像这样:

    git+https://github.com/mixmaxhq/mongo-cursor-pagination.git#40c3f8d
    

    https://docs.npmjs.com/cli/install

    npm install private github repositories by dependency in package.json

    【讨论】:

      【解决方案2】:

      你可以像这样直接从github下载:

      npm install https://github.com/mixmaxhq/mongo-cursor-pagination/tarball/master --save
      

      如果您需要再次执行此操作:https://github.com/{USER}/{REPO}/tarball/{BRANCH}

      【讨论】:

        【解决方案3】:

        在 Git URL 中指定分支名称而不是提交哈希应该会导致 NPM 从该分支获取最新的。例如,要从 master 获取最新信息:

        git+https://github.com/mixmaxhq/mongo-cursor-pagination.git#master

        【讨论】:

          猜你喜欢
          • 2012-01-01
          • 1970-01-01
          • 2019-04-06
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-08-15
          • 1970-01-01
          • 2019-06-19
          相关资源
          最近更新 更多