npm update – 只有在模块没有安装时才会更新

我对npm update的理解是,如果没有安装或者没有安装最新版本的模块,它只会更新模块。 作为构build过程的一部分,我们运行一个npm更新来确保我们有最新的模块,但是它在每个包上运行一个GET,不pipe是否需要更新。 即使npm更新不需要更新,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 ... 

即使npm更新不需要更新,npm更新是否确实拉下了模块?

不,不。 GET请求只返回一个json对象,并提供关于该特定模块的信息。 npm这样做是为了检查本地安装的版本是否需要更新。 如果本地模块已经过时, npm下载它。

我猜测它只提取有关软件包的信息,只有在发现更新的时候才更新它们

 npm update -g some_module 

如果你以前没有安装过some_module,这个默默无闻