gpt4 book ai didi

node.js - npm update - 仅当模块未安装/已安装最新版本时才更新

转载 作者:太空宇宙 更新时间:2023-11-03 23:40:13 25 4
gpt4 key购买 nike

我对 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
...

最佳答案

Does npm update really pull down the modules even if it does not need to update them?

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

关于node.js - npm update - 仅当模块未安装/已安装最新版本时才更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25329694/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com