npm install 生成的package-lock.json作用

来源:互联网 发布:js对象的tostring方法 编辑:程序博客网 时间:2024/06/15 07:19

官网解释:

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, orpackage.json. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.

大概意思好像是:

package-lock.json是当 node_modules 或 package.json 发生变化时自动生成的文件。这个文件主要功能是确定当前安装的包的依赖,以便后续重新安装的时候生成相同的依赖,而忽略项目开发过程中有些依赖已经发生的更新。

对比之下,大概是想做类似 Yarn 的功能。

详细内容,请自行查阅官方文档:docs.npmjs.com/files/pa


原创粉丝点击