【问题标题】:npm update - does it only update if the module is not installed/on latest version alreadynpm update - 是否仅在模块未安装/最新版本时才更新
【发布时间】:2014-10-09 09:10:47
【问题描述】:

我对 npm update 的理解是,它只会在模块未安装或不在最新版本上时更新模块。作为我们构建过程的一部分,我们运行 npm update 以确保我们拥有最新的模块,但它在每个单独的包上运行 GET,无论它是否需要更新。即使不需要更新,npm update 真的会拉下模块吗?

npm update
npm http GET https://registry.npmjs.org/grunt/latest
npm http GET https://registry.npmjs.org/grunt-contrib-copy/latest
npm http GET https://registry.npmjs.org/grunt-contrib-concat/latest
npm http GET https://registry.npmjs.org/grunt-contrib-coffee/latest
npm http GET https://registry.npmjs.org/grunt-contrib-jst/latest
...

【问题讨论】:

    标签: node.js npm


    【解决方案1】:
    npm update -g some_module
    

    如果您之前没有安装过 some_module,这将不会执行任何操作

    【讨论】:

      【解决方案2】:

      即使不需要更新,npm update 真的会拉下模块吗?

      不,它没有。 GET 请求仅返回一个 json 对象,其中包含有关该特定模块的信息。 npm 这样做是为了检查本地安装的版本是否需要更新。如果本地模块过时,npm 会下载它。

      【讨论】:

      • 我调高了日志级别 - GET 花费了很长时间,但结果显示请求超时。
      【解决方案3】:

      我猜它只获取有关包的信息并仅在发现更新时更新它们

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-04-01
        • 1970-01-01
        • 1970-01-01
        • 2014-08-27
        • 1970-01-01
        • 1970-01-01
        • 2017-08-13
        • 1970-01-01
        相关资源
        最近更新 更多