JamesE
JamesE

Reputation: 3923

npm update - does it only update if the module is not installed/on latest version already

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

Upvotes: 1

Views: 78

Answers (3)

Scott Stensland
Scott Stensland

Reputation: 28335

npm update -g some_module

This silently does nothing if you have not previously installed some_module

Upvotes: 0

Rodrigo Medeiros
Rodrigo Medeiros

Reputation: 7862

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

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.

Upvotes: 1

monkeyinsight
monkeyinsight

Reputation: 4859

My guess that it only fetches information about packages and update them only if it found newer

Upvotes: 1

Related Questions