1 ---
2 title: package-lock.json
3 section: 5
4 description: A manifestation of the manifest
5 github_repo: npm/cli
6 github_branch: release/v6
7 github_path: docs/content/configuring-npm/package-lock-json.md
8 redirect_from:
9 - /cli-documentation/v6/configuring-npm/package-lock-json
10 - /cli-documentation/v6/configuring-npm/package-lock.json
11 - /cli-documentation/v6/files/package-lock-json
12 - /cli-documentation/v6/files/package-lock.json
13 - /cli/v6/configuring-npm/package-lock.json
14 - /cli/v6/files/package-lock-json
15 - /cli/v6/files/package-lock.json
16 ---
17
18 ### Description
19
20 `package-lock.json` is automatically generated for any operations where npm modifies either the `node_modules` tree, or `package.json`. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.
21
22 This file is intended to be committed into source repositories, and serves various purposes:
23
24 - Describe a single representation of a dependency tree such that teammates, deployments, and continuous integration are guaranteed to install exactly the same dependencies.
25
26 - Provide a facility for users to "time-travel" to previous states of `node_modules` without having to commit the directory itself.
27
28 - To facilitate greater visibility of tree changes through readable source control diffs.
29
30 - And optimize the installation process by allowing npm to skip repeated metadata resolutions for previously-installed packages.
31
32 One key detail about `package-lock.json` is that it cannot be published, and it will be ignored if found in any place other than the toplevel package. It shares a format with [npm-shrinkwrap.json](/cli/v6/configuring-npm/shrinkwrap-json), which is essentially the same file, but allows publication. This is not recommended unless deploying a CLI tool or otherwise using the publication process for producing production packages.
33
34 If both `package-lock.json` and `npm-shrinkwrap.json` are present in the root of a package, `package-lock.json` will be completely ignored.
35
36 ### File Format
37
38 #### name
39
40 The name of the package this is a package-lock for. This must match what's in `package.json`.
41
42 #### version
43
44 The version of the package this is a package-lock for. This must match what's in `package.json`.
45
46 #### lockfileVersion
47
48 An integer version, starting at `1` with the version number of this document whose semantics were used when generating this `package-lock.json`.
49
50 #### packageIntegrity
51
52 This is a [subresource integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) value created from the `package.json`. No preprocessing of the `package.json` should be done. Subresource integrity strings can be produced by modules like [`ssri`](https://www.npmjs.com/package/ssri).
53
54 #### preserveSymlinks
55
56 Indicates that the install was done with the environment variable `NODE_PRESERVE_SYMLINKS` enabled. The installer should insist that the value of this property match that environment variable.
57
58 #### dependencies
59
60 A mapping of package name to dependency object. Dependency objects have the following properties:
61
62 ##### version
63
64 This is a specifier that uniquely identifies this package and should be usable in fetching a new copy of it.
65
66 - bundled dependencies: Regardless of source, this is a version number that is purely for informational purposes.
67 - registry sources: This is a version number. (eg, `1.2.3`)
68 - git sources: This is a git specifier with resolved committish. (eg, `git+https://example.com/foo/bar#115311855adb0789a0466714ed48a1499ffea97e`)
69 - http tarball sources: This is the URL of the tarball. (eg, `https://example.com/example-1.3.0.tgz`)
70 - local tarball sources: This is the file URL of the tarball. (eg `file:///opt/storage/example-1.3.0.tgz`)
71 - local link sources: This is the file URL of the link. (eg `file:libs/our-module`)
72
73 ##### integrity
74
75 This is a [Standard Subresource Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) for this resource.
76
77 - For bundled dependencies this is not included, regardless of source.
78 - For registry sources, this is the `integrity` that the registry provided, or if one wasn't provided the SHA1 in `shasum`.
79 - For git sources this is the specific commit hash we cloned from.
80 - For remote tarball sources this is an integrity based on a SHA512 of the file.
81 - For local tarball sources: This is an integrity field based on the SHA512 of the file.
82
83 ##### resolved
84
85 - For bundled dependencies this is not included, regardless of source.
86 - For registry sources this is path of the tarball relative to the registry URL. If the tarball URL isn't on the same server as the registry URL then this is a complete URL.
87
88 ##### bundled
89
90 If true, this is the bundled dependency and will be installed by the parent module. When installing, this module will be extracted from the parent module during the extract phase, not installed as a separate dependency.
91
92 ##### dev
93
94 If true then this dependency is either a development dependency ONLY of the top level module or a transitive dependency of one. This is false for dependencies that are both a development dependency of the top level and a transitive dependency of a non-development dependency of the top level.
95
96 ##### optional
97
98 If true then this dependency is either an optional dependency ONLY of the top level module or a transitive dependency of one. This is false for dependencies that are both an optional dependency of the top level and a transitive dependency of a non-optional dependency of the top level.
99
100 All optional dependencies should be included even if they're uninstallable on the current platform.
101
102 ##### requires
103
104 This is a mapping of module name to version. This is a list of everything this module requires, regardless of where it will be installed. The version should match via normal matching rules a dependency either in our `dependencies` or in a level higher than us.
105
106 ##### dependencies
107
108 The dependencies of this dependency, exactly as at the top level.
109
110 ### See also
111
112 - [npm shrinkwrap](/cli/v6/commands/npm-shrinkwrap)
113 - [shrinkwrap.json](/cli/v6/configuring-npm/shrinkwrap-json)
114 - [package-locks](/cli/v6/configuring-npm/package-locks)
115 - [package.json](/cli/v6/configuring-npm/package-json)
116 - [npm install](/cli/v6/commands/npm-install)