简体   繁体   English

什么是package-lock.json?

[英]What is package-lock.json?

Is there any kind-teacher can answer my question above? 有没有亲切的老师可以回答我上面的问题?

FYI I'm using WebStorm and making with node.js I installed npm module like nconf and package-lock.json has made. 仅供参考我正在使用WebStorm并使用node.js我安装了npm模块,如nconf和package-lock.json。 I expected package.json would've been made. 我期望package.json会被制作出来。

Thank you. 谢谢。

Describe the dependency tree in a given moment, so with this description all the dependencies can be created again exactly the same way it was, this ensures the expected behavior from the dependencies. 描述给定时刻的依赖关系树,因此使用此描述可以再次创建所有依赖关系,这确保了依赖关系的预期行为。

In the npm documentation you can read: npm文档中,您可以阅读:

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. 对于npm修改node_modules树或package.json的任何操作,都会自动生成package-lock.json。 It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates. 它描述了生成的确切树,以便后续安装能够生成相同的树,而不管中间依赖性更新。

This file is intended to be committed into source repositories, and serves various purposes: 此文件旨在提交到源存储库,并用于各种目的:

Describe a single representation of a dependency tree such that teammates, deployments, and continuous integration are guaranteed to install exactly the same dependencies. 描述依赖关系树的单个表示,以确保队友,部署和持续集成能够安装完全相同的依赖关系。

Provide a facility for users to "time-travel" to previous states of node_modules without having to commit the directory itself. 为用户提供一种“时间旅行”到node_modules的先前状态的工具,而无需提交目录本身。

To facilitate greater visibility of tree changes through readable source control diffs. 通过可读的源代码控制差异来促进树更改的更大可见性。

And optimize the installation process by allowing npm to skip repeated metadata resolutions for previously-installed packages. 并通过允许npm跳过以前安装的软件包的重复元数据解析来优化安装过程。

Package-lock.json文件包含package.json文件中列出的依赖项以及应安装的依赖项的特定版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM