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