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

标签 node.js npm

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

相关文章:

node.js - 如何使用 ReSTLer 下载网站并将其写入文件?

node.js - package.json 中的包放在哪里?依赖或开发依赖

javascript - 为 Angular 安装 Node.js - connect.static 和 karma

node.js - NodeJS 真的是单线程还是多线程?

javascript - 在环回中过滤远程方法

node.js - 如何关闭可读流(结束前)?

node.js - 由于版本不可用,npm install 不起作用

typescript - 如何配置 create-react-app typescript 以自动将 ts-loader 用于基于 typescript 的节点模块?

node.js - 如何在不使用 npm install <package_name> 或 yarn install 的情况下安装/下载软件包

javascript - 使用一个函数通过 axios 处理 POST/GET API 调用