My understanding of npm update is that it will only update modules if that module is not installed or is not on the latest version. As part of our build process we run a npm update to make sure we have the latest modules, but it runs a GET on every single package whether or not it needs to be updated. Does npm update really pull down the modules even if it does not need to update them?
我对npm update的理解是,如果没有安装该模块或者没有安装最新版本,它只会更新模块。作为构建过程的一部分,我们运行npm更新以确保我们拥有最新的模块,但无论是否需要更新,它都会在每个软件包上运行GET。 npm更新是否真的下拉模块,即使它不需要更新它们?
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
...
3 个解决方案
#1
1
Does npm update really pull down the modules even if it does not need to update them?
npm更新是否真的下拉模块,即使它不需要更新它们?
No, it doesn't. The GET
requests only return a json
object, with information about that particular module. npm
does it in order to check if the locally installed version needs to be updated. If the local module is outdated, npm
downloads it.
不,它没有。 GET请求仅返回一个json对象,其中包含有关该特定模块的信息。 npm是为了检查本地安装的版本是否需要更新。如果本地模块已过时,则npm下载它。
#2
1
My guess that it only fetches information about packages and update them only if it found newer
我的猜测是它只获取有关包的信息,并且只有在发现更新时才更新它们
#3
0
npm update -g some_module
This silently does nothing if you have not previously installed some_module
如果您以前没有安装some_module,这将无声无效
#1
1
Does npm update really pull down the modules even if it does not need to update them?
npm更新是否真的下拉模块,即使它不需要更新它们?
No, it doesn't. The GET
requests only return a json
object, with information about that particular module. npm
does it in order to check if the locally installed version needs to be updated. If the local module is outdated, npm
downloads it.
不,它没有。 GET请求仅返回一个json对象,其中包含有关该特定模块的信息。 npm是为了检查本地安装的版本是否需要更新。如果本地模块已过时,则npm下载它。
#2
1
My guess that it only fetches information about packages and update them only if it found newer
我的猜测是它只获取有关包的信息,并且只有在发现更新时才更新它们
#3
0
npm update -g some_module
This silently does nothing if you have not previously installed some_module
如果您以前没有安装some_module,这将无声无效