11cb0ef41Sopenharmony_ci<!DOCTYPE html><html><head>
21cb0ef41Sopenharmony_ci<meta charset="utf-8">
31cb0ef41Sopenharmony_ci<title>package-lock.json</title>
41cb0ef41Sopenharmony_ci<style>
51cb0ef41Sopenharmony_cibody {
61cb0ef41Sopenharmony_ci    background-color: #ffffff;
71cb0ef41Sopenharmony_ci    color: #24292e;
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci    margin: 0;
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci    line-height: 1.5;
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
141cb0ef41Sopenharmony_ci}
151cb0ef41Sopenharmony_ci#rainbar {
161cb0ef41Sopenharmony_ci    height: 10px;
171cb0ef41Sopenharmony_ci    background-image: linear-gradient(139deg, #fb8817, #ff4b01, #c12127, #e02aff);
181cb0ef41Sopenharmony_ci}
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cia {
211cb0ef41Sopenharmony_ci    text-decoration: none;
221cb0ef41Sopenharmony_ci    color: #0366d6;
231cb0ef41Sopenharmony_ci}
241cb0ef41Sopenharmony_cia:hover {
251cb0ef41Sopenharmony_ci    text-decoration: underline;
261cb0ef41Sopenharmony_ci}
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_cipre {
291cb0ef41Sopenharmony_ci    margin: 1em 0px;
301cb0ef41Sopenharmony_ci    padding: 1em;
311cb0ef41Sopenharmony_ci    border: solid 1px #e1e4e8;
321cb0ef41Sopenharmony_ci    border-radius: 6px;
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci    display: block;
351cb0ef41Sopenharmony_ci    overflow: auto;
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci    white-space: pre;
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
401cb0ef41Sopenharmony_ci    color: #393a34;
411cb0ef41Sopenharmony_ci}
421cb0ef41Sopenharmony_cicode {
431cb0ef41Sopenharmony_ci    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
441cb0ef41Sopenharmony_ci    font-size: 85%;
451cb0ef41Sopenharmony_ci    padding: 0.2em 0.4em;
461cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
471cb0ef41Sopenharmony_ci    color: #393a34;
481cb0ef41Sopenharmony_ci}
491cb0ef41Sopenharmony_cipre > code {
501cb0ef41Sopenharmony_ci    padding: 0;
511cb0ef41Sopenharmony_ci    background-color: inherit;
521cb0ef41Sopenharmony_ci    color: inherit;
531cb0ef41Sopenharmony_ci}
541cb0ef41Sopenharmony_cih1, h2, h3 {
551cb0ef41Sopenharmony_ci    font-weight: 600;
561cb0ef41Sopenharmony_ci}
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci#logobar {
591cb0ef41Sopenharmony_ci    background-color: #333333;
601cb0ef41Sopenharmony_ci    margin: 0 auto;
611cb0ef41Sopenharmony_ci    padding: 1em 4em;
621cb0ef41Sopenharmony_ci}
631cb0ef41Sopenharmony_ci#logobar .logo {
641cb0ef41Sopenharmony_ci    float: left;
651cb0ef41Sopenharmony_ci}
661cb0ef41Sopenharmony_ci#logobar .title {
671cb0ef41Sopenharmony_ci    font-weight: 600;
681cb0ef41Sopenharmony_ci    color: #dddddd;
691cb0ef41Sopenharmony_ci    float: left;
701cb0ef41Sopenharmony_ci    margin: 5px 0 0 1em;
711cb0ef41Sopenharmony_ci}
721cb0ef41Sopenharmony_ci#logobar:after {
731cb0ef41Sopenharmony_ci    content: "";
741cb0ef41Sopenharmony_ci    display: block;
751cb0ef41Sopenharmony_ci    clear: both;
761cb0ef41Sopenharmony_ci}
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ci#content {
791cb0ef41Sopenharmony_ci    margin: 0 auto;
801cb0ef41Sopenharmony_ci    padding: 0 4em;
811cb0ef41Sopenharmony_ci}
821cb0ef41Sopenharmony_ci
831cb0ef41Sopenharmony_ci#table_of_contents > h2 {
841cb0ef41Sopenharmony_ci    font-size: 1.17em;
851cb0ef41Sopenharmony_ci}
861cb0ef41Sopenharmony_ci#table_of_contents ul:first-child {
871cb0ef41Sopenharmony_ci    border: solid 1px #e1e4e8;
881cb0ef41Sopenharmony_ci    border-radius: 6px;
891cb0ef41Sopenharmony_ci    padding: 1em;
901cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
911cb0ef41Sopenharmony_ci    color: #393a34;
921cb0ef41Sopenharmony_ci}
931cb0ef41Sopenharmony_ci#table_of_contents ul {
941cb0ef41Sopenharmony_ci    list-style-type: none;
951cb0ef41Sopenharmony_ci    padding-left: 1.5em;
961cb0ef41Sopenharmony_ci}
971cb0ef41Sopenharmony_ci#table_of_contents li {
981cb0ef41Sopenharmony_ci    font-size: 0.9em;
991cb0ef41Sopenharmony_ci}
1001cb0ef41Sopenharmony_ci#table_of_contents li a {
1011cb0ef41Sopenharmony_ci    color: #000000;
1021cb0ef41Sopenharmony_ci}
1031cb0ef41Sopenharmony_ci
1041cb0ef41Sopenharmony_ciheader.title {
1051cb0ef41Sopenharmony_ci    border-bottom: solid 1px #e1e4e8;
1061cb0ef41Sopenharmony_ci}
1071cb0ef41Sopenharmony_ciheader.title > h1 {
1081cb0ef41Sopenharmony_ci    margin-bottom: 0.25em;
1091cb0ef41Sopenharmony_ci}
1101cb0ef41Sopenharmony_ciheader.title > .description {
1111cb0ef41Sopenharmony_ci    display: block;
1121cb0ef41Sopenharmony_ci    margin-bottom: 0.5em;
1131cb0ef41Sopenharmony_ci    line-height: 1;
1141cb0ef41Sopenharmony_ci}
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_cifooter#edit {
1171cb0ef41Sopenharmony_ci    border-top: solid 1px #e1e4e8;
1181cb0ef41Sopenharmony_ci    margin: 3em 0 4em 0;
1191cb0ef41Sopenharmony_ci    padding-top: 2em;
1201cb0ef41Sopenharmony_ci}
1211cb0ef41Sopenharmony_ci</style>
1221cb0ef41Sopenharmony_ci</head>
1231cb0ef41Sopenharmony_ci<body>
1241cb0ef41Sopenharmony_ci<div id="banner">
1251cb0ef41Sopenharmony_ci<div id="rainbar"></div>
1261cb0ef41Sopenharmony_ci<div id="logobar">
1271cb0ef41Sopenharmony_ci<svg class="logo" role="img" height="32" width="32" viewBox="0 0 700 700">
1281cb0ef41Sopenharmony_ci<polygon fill="#cb0000" points="0,700 700,700 700,0 0,0"></polygon>
1291cb0ef41Sopenharmony_ci<polygon fill="#ffffff" points="150,550 350,550 350,250 450,250 450,550 550,550 550,150 150,150"></polygon>
1301cb0ef41Sopenharmony_ci</svg>
1311cb0ef41Sopenharmony_ci<div class="title">
1321cb0ef41Sopenharmony_cinpm command-line interface
1331cb0ef41Sopenharmony_ci</div>
1341cb0ef41Sopenharmony_ci</div>
1351cb0ef41Sopenharmony_ci</div>
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci<section id="content">
1381cb0ef41Sopenharmony_ci<header class="title">
1391cb0ef41Sopenharmony_ci<h1 id="package-lockjson">package-lock.json</h1>
1401cb0ef41Sopenharmony_ci<span class="description">A manifestation of the manifest</span>
1411cb0ef41Sopenharmony_ci</header>
1421cb0ef41Sopenharmony_ci
1431cb0ef41Sopenharmony_ci<section id="table_of_contents">
1441cb0ef41Sopenharmony_ci<h2 id="table-of-contents">Table of contents</h2>
1451cb0ef41Sopenharmony_ci<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#package-lockjson-vs-npm-shrinkwrapjson"><code>package-lock.json</code> vs <code>npm-shrinkwrap.json</code></a></li><li><a href="#hidden-lockfiles">Hidden Lockfiles</a></li><li><a href="#handling-old-lockfiles">Handling Old Lockfiles</a></li><li><a href="#file-format">File Format</a></li><ul><li><a href="#name"><code>name</code></a></li><li><a href="#version"><code>version</code></a></li><li><a href="#lockfileversion"><code>lockfileVersion</code></a></li><li><a href="#packages"><code>packages</code></a></li><li><a href="#dependencies">dependencies</a></li></ul><li><a href="#see-also">See also</a></li></ul></div>
1461cb0ef41Sopenharmony_ci</section>
1471cb0ef41Sopenharmony_ci
1481cb0ef41Sopenharmony_ci<div id="_content"><h3 id="description">Description</h3>
1491cb0ef41Sopenharmony_ci<p><code>package-lock.json</code> is automatically generated for any operations where npm
1501cb0ef41Sopenharmony_cimodifies either the <code>node_modules</code> tree, or <code>package.json</code>. It describes the
1511cb0ef41Sopenharmony_ciexact tree that was generated, such that subsequent installs are able to
1521cb0ef41Sopenharmony_cigenerate identical trees, regardless of intermediate dependency updates.</p>
1531cb0ef41Sopenharmony_ci<p>This file is intended to be committed into source repositories, and serves
1541cb0ef41Sopenharmony_civarious purposes:</p>
1551cb0ef41Sopenharmony_ci<ul>
1561cb0ef41Sopenharmony_ci<li>
1571cb0ef41Sopenharmony_ci<p>Describe a single representation of a dependency tree such that
1581cb0ef41Sopenharmony_citeammates, deployments, and continuous integration are guaranteed to
1591cb0ef41Sopenharmony_ciinstall exactly the same dependencies.</p>
1601cb0ef41Sopenharmony_ci</li>
1611cb0ef41Sopenharmony_ci<li>
1621cb0ef41Sopenharmony_ci<p>Provide a facility for users to "time-travel" to previous states of
1631cb0ef41Sopenharmony_ci<code>node_modules</code> without having to commit the directory itself.</p>
1641cb0ef41Sopenharmony_ci</li>
1651cb0ef41Sopenharmony_ci<li>
1661cb0ef41Sopenharmony_ci<p>Facilitate greater visibility of tree changes through readable source
1671cb0ef41Sopenharmony_cicontrol diffs.</p>
1681cb0ef41Sopenharmony_ci</li>
1691cb0ef41Sopenharmony_ci<li>
1701cb0ef41Sopenharmony_ci<p>Optimize the installation process by allowing npm to skip repeated
1711cb0ef41Sopenharmony_cimetadata resolutions for previously-installed packages.</p>
1721cb0ef41Sopenharmony_ci</li>
1731cb0ef41Sopenharmony_ci<li>
1741cb0ef41Sopenharmony_ci<p>As of npm v7, lockfiles include enough information to gain a complete
1751cb0ef41Sopenharmony_cipicture of the package tree, reducing the need to read <code>package.json</code>
1761cb0ef41Sopenharmony_cifiles, and allowing for significant performance improvements.</p>
1771cb0ef41Sopenharmony_ci</li>
1781cb0ef41Sopenharmony_ci</ul>
1791cb0ef41Sopenharmony_ci<h3 id="package-lockjson-vs-npm-shrinkwrapjson"><code>package-lock.json</code> vs <code>npm-shrinkwrap.json</code></h3>
1801cb0ef41Sopenharmony_ci<p>Both of these files have the same format, and perform similar functions in
1811cb0ef41Sopenharmony_cithe root of a project.</p>
1821cb0ef41Sopenharmony_ci<p>The difference is that <code>package-lock.json</code> cannot be published, and it will
1831cb0ef41Sopenharmony_cibe ignored if found in any place other than the root project.</p>
1841cb0ef41Sopenharmony_ci<p>In contrast, <a href="../configuring-npm/npm-shrinkwrap-json.html">npm-shrinkwrap.json</a> allows
1851cb0ef41Sopenharmony_cipublication, and defines the dependency tree from the point encountered.
1861cb0ef41Sopenharmony_ciThis is not recommended unless deploying a CLI tool or otherwise using the
1871cb0ef41Sopenharmony_cipublication process for producing production packages.</p>
1881cb0ef41Sopenharmony_ci<p>If both <code>package-lock.json</code> and <code>npm-shrinkwrap.json</code> are present in the
1891cb0ef41Sopenharmony_ciroot of a project, <code>npm-shrinkwrap.json</code> will take precedence and
1901cb0ef41Sopenharmony_ci<code>package-lock.json</code> will be ignored.</p>
1911cb0ef41Sopenharmony_ci<h3 id="hidden-lockfiles">Hidden Lockfiles</h3>
1921cb0ef41Sopenharmony_ci<p>In order to avoid processing the <code>node_modules</code> folder repeatedly, npm as
1931cb0ef41Sopenharmony_ciof v7 uses a "hidden" lockfile present in
1941cb0ef41Sopenharmony_ci<code>node_modules/.package-lock.json</code>.  This contains information about the
1951cb0ef41Sopenharmony_citree, and is used in lieu of reading the entire <code>node_modules</code> hierarchy
1961cb0ef41Sopenharmony_ciprovided that the following conditions are met:</p>
1971cb0ef41Sopenharmony_ci<ul>
1981cb0ef41Sopenharmony_ci<li>All package folders it references exist in the <code>node_modules</code> hierarchy.</li>
1991cb0ef41Sopenharmony_ci<li>No package folders exist in the <code>node_modules</code> hierarchy that are not
2001cb0ef41Sopenharmony_cilisted in the lockfile.</li>
2011cb0ef41Sopenharmony_ci<li>The modified time of the file is at least as recent as all of the package
2021cb0ef41Sopenharmony_cifolders it references.</li>
2031cb0ef41Sopenharmony_ci</ul>
2041cb0ef41Sopenharmony_ci<p>That is, the hidden lockfile will only be relevant if it was created as
2051cb0ef41Sopenharmony_cipart of the most recent update to the package tree.  If another CLI mutates
2061cb0ef41Sopenharmony_cithe tree in any way, this will be detected, and the hidden lockfile will be
2071cb0ef41Sopenharmony_ciignored.</p>
2081cb0ef41Sopenharmony_ci<p>Note that it <em>is</em> possible to manually change the <em>contents</em> of a package
2091cb0ef41Sopenharmony_ciin such a way that the modified time of the package folder is unaffected.
2101cb0ef41Sopenharmony_ciFor example, if you add a file to <code>node_modules/foo/lib/bar.js</code>, then the
2111cb0ef41Sopenharmony_cimodified time on <code>node_modules/foo</code> will not reflect this change.  If you
2121cb0ef41Sopenharmony_ciare manually editing files in <code>node_modules</code>, it is generally best to
2131cb0ef41Sopenharmony_cidelete the file at <code>node_modules/.package-lock.json</code>.</p>
2141cb0ef41Sopenharmony_ci<p>As the hidden lockfile is ignored by older npm versions, it does not
2151cb0ef41Sopenharmony_cicontain the backwards compatibility affordances present in "normal"
2161cb0ef41Sopenharmony_cilockfiles.  That is, it is <code>lockfileVersion: 3</code>, rather than
2171cb0ef41Sopenharmony_ci<code>lockfileVersion: 2</code>.</p>
2181cb0ef41Sopenharmony_ci<h3 id="handling-old-lockfiles">Handling Old Lockfiles</h3>
2191cb0ef41Sopenharmony_ci<p>When npm detects a lockfile from npm v6 or before during the package
2201cb0ef41Sopenharmony_ciinstallation process, it is automatically updated to fetch missing
2211cb0ef41Sopenharmony_ciinformation from either the <code>node_modules</code> tree or (in the case of empty
2221cb0ef41Sopenharmony_ci<code>node_modules</code> trees or very old lockfile formats) the npm registry.</p>
2231cb0ef41Sopenharmony_ci<h3 id="file-format">File Format</h3>
2241cb0ef41Sopenharmony_ci<h4 id="name"><code>name</code></h4>
2251cb0ef41Sopenharmony_ci<p>The name of the package this is a package-lock for. This will match what's
2261cb0ef41Sopenharmony_ciin <code>package.json</code>.</p>
2271cb0ef41Sopenharmony_ci<h4 id="version"><code>version</code></h4>
2281cb0ef41Sopenharmony_ci<p>The version of the package this is a package-lock for. This will match
2291cb0ef41Sopenharmony_ciwhat's in <code>package.json</code>.</p>
2301cb0ef41Sopenharmony_ci<h4 id="lockfileversion"><code>lockfileVersion</code></h4>
2311cb0ef41Sopenharmony_ci<p>An integer version, starting at <code>1</code> with the version number of this
2321cb0ef41Sopenharmony_cidocument whose semantics were used when generating this
2331cb0ef41Sopenharmony_ci<code>package-lock.json</code>.</p>
2341cb0ef41Sopenharmony_ci<p>Note that the file format changed significantly in npm v7 to track
2351cb0ef41Sopenharmony_ciinformation that would have otherwise required looking in <code>node_modules</code> or
2361cb0ef41Sopenharmony_cithe npm registry.  Lockfiles generated by npm v7 will contain
2371cb0ef41Sopenharmony_ci<code>lockfileVersion: 2</code>.</p>
2381cb0ef41Sopenharmony_ci<ul>
2391cb0ef41Sopenharmony_ci<li>No version provided: an "ancient" shrinkwrap file from a version of npm
2401cb0ef41Sopenharmony_ciprior to npm v5.</li>
2411cb0ef41Sopenharmony_ci<li><code>1</code>: The lockfile version used by npm v5 and v6.</li>
2421cb0ef41Sopenharmony_ci<li><code>2</code>: The lockfile version used by npm v7 and v8. Backwards compatible to v1
2431cb0ef41Sopenharmony_cilockfiles.</li>
2441cb0ef41Sopenharmony_ci<li><code>3</code>: The lockfile version used by npm v9 and above. Backwards compatible to npm v7.</li>
2451cb0ef41Sopenharmony_ci</ul>
2461cb0ef41Sopenharmony_ci<p>npm will always attempt to get whatever data it can out of a lockfile, even
2471cb0ef41Sopenharmony_ciif it is not a version that it was designed to support.</p>
2481cb0ef41Sopenharmony_ci<h4 id="packages"><code>packages</code></h4>
2491cb0ef41Sopenharmony_ci<p>This is an object that maps package locations to an object containing the
2501cb0ef41Sopenharmony_ciinformation about that package.</p>
2511cb0ef41Sopenharmony_ci<p>The root project is typically listed with a key of <code>""</code>, and all other
2521cb0ef41Sopenharmony_cipackages are listed with their relative paths from the root project folder.</p>
2531cb0ef41Sopenharmony_ci<p>Package descriptors have the following fields:</p>
2541cb0ef41Sopenharmony_ci<ul>
2551cb0ef41Sopenharmony_ci<li>
2561cb0ef41Sopenharmony_ci<p>version: The version found in <code>package.json</code></p>
2571cb0ef41Sopenharmony_ci</li>
2581cb0ef41Sopenharmony_ci<li>
2591cb0ef41Sopenharmony_ci<p>resolved: The place where the package was actually resolved from.  In
2601cb0ef41Sopenharmony_cithe case of packages fetched from the registry, this will be a url to a
2611cb0ef41Sopenharmony_citarball.  In the case of git dependencies, this will be the full git url
2621cb0ef41Sopenharmony_ciwith commit sha.  In the case of link dependencies, this will be the
2631cb0ef41Sopenharmony_cilocation of the link target. <code>registry.npmjs.org</code> is a magic value meaning
2641cb0ef41Sopenharmony_ci"the currently configured registry".</p>
2651cb0ef41Sopenharmony_ci</li>
2661cb0ef41Sopenharmony_ci<li>
2671cb0ef41Sopenharmony_ci<p>integrity: A <code>sha512</code> or <code>sha1</code> <a href="https://w3c.github.io/webappsec/specs/subresourceintegrity/">Standard Subresource
2681cb0ef41Sopenharmony_ciIntegrity</a>
2691cb0ef41Sopenharmony_cistring for the artifact that was unpacked in this location.</p>
2701cb0ef41Sopenharmony_ci</li>
2711cb0ef41Sopenharmony_ci<li>
2721cb0ef41Sopenharmony_ci<p>link: A flag to indicate that this is a symbolic link.  If this is
2731cb0ef41Sopenharmony_cipresent, no other fields are specified, since the link target will also
2741cb0ef41Sopenharmony_cibe included in the lockfile.</p>
2751cb0ef41Sopenharmony_ci</li>
2761cb0ef41Sopenharmony_ci<li>
2771cb0ef41Sopenharmony_ci<p>dev, optional, devOptional: If the package is strictly part of the
2781cb0ef41Sopenharmony_ci<code>devDependencies</code> tree, then <code>dev</code> will be true.  If it is strictly part
2791cb0ef41Sopenharmony_ciof the <code>optionalDependencies</code> tree, then <code>optional</code> will be set.  If it
2801cb0ef41Sopenharmony_ciis both a <code>dev</code> dependency <em>and</em> an <code>optional</code> dependency of a non-dev
2811cb0ef41Sopenharmony_cidependency, then <code>devOptional</code> will be set.  (An <code>optional</code> dependency of
2821cb0ef41Sopenharmony_cia <code>dev</code> dependency will have both <code>dev</code> and <code>optional</code> set.)</p>
2831cb0ef41Sopenharmony_ci</li>
2841cb0ef41Sopenharmony_ci<li>
2851cb0ef41Sopenharmony_ci<p>inBundle: A flag to indicate that the package is a bundled dependency.</p>
2861cb0ef41Sopenharmony_ci</li>
2871cb0ef41Sopenharmony_ci<li>
2881cb0ef41Sopenharmony_ci<p>hasInstallScript: A flag to indicate that the package has a <code>preinstall</code>,
2891cb0ef41Sopenharmony_ci<code>install</code>, or <code>postinstall</code> script.</p>
2901cb0ef41Sopenharmony_ci</li>
2911cb0ef41Sopenharmony_ci<li>
2921cb0ef41Sopenharmony_ci<p>hasShrinkwrap: A flag to indicate that the package has an
2931cb0ef41Sopenharmony_ci<code>npm-shrinkwrap.json</code> file.</p>
2941cb0ef41Sopenharmony_ci</li>
2951cb0ef41Sopenharmony_ci<li>
2961cb0ef41Sopenharmony_ci<p>bin, license, engines, dependencies, optionalDependencies: fields from
2971cb0ef41Sopenharmony_ci<code>package.json</code></p>
2981cb0ef41Sopenharmony_ci</li>
2991cb0ef41Sopenharmony_ci</ul>
3001cb0ef41Sopenharmony_ci<h4 id="dependencies">dependencies</h4>
3011cb0ef41Sopenharmony_ci<p>Legacy data for supporting versions of npm that use <code>lockfileVersion: 1</code>.
3021cb0ef41Sopenharmony_ciThis is a mapping of package names to dependency objects.  Because the
3031cb0ef41Sopenharmony_ciobject structure is strictly hierarchical, symbolic link dependencies are
3041cb0ef41Sopenharmony_cisomewhat challenging to represent in some cases.</p>
3051cb0ef41Sopenharmony_ci<p>npm v7 ignores this section entirely if a <code>packages</code> section is present,
3061cb0ef41Sopenharmony_cibut does keep it up to date in order to support switching between npm v6
3071cb0ef41Sopenharmony_ciand npm v7.</p>
3081cb0ef41Sopenharmony_ci<p>Dependency objects have the following fields:</p>
3091cb0ef41Sopenharmony_ci<ul>
3101cb0ef41Sopenharmony_ci<li>
3111cb0ef41Sopenharmony_ci<p>version: a specifier that varies depending on the nature of the package,
3121cb0ef41Sopenharmony_ciand is usable in fetching a new copy of it.</p>
3131cb0ef41Sopenharmony_ci<ul>
3141cb0ef41Sopenharmony_ci<li>bundled dependencies: Regardless of source, this is a version number
3151cb0ef41Sopenharmony_cithat is purely for informational purposes.</li>
3161cb0ef41Sopenharmony_ci<li>registry sources: This is a version number. (eg, <code>1.2.3</code>)</li>
3171cb0ef41Sopenharmony_ci<li>git sources: This is a git specifier with resolved committish. (eg,
3181cb0ef41Sopenharmony_ci<code>git+https://example.com/foo/bar#115311855adb0789a0466714ed48a1499ffea97e</code>)</li>
3191cb0ef41Sopenharmony_ci<li>http tarball sources: This is the URL of the tarball. (eg,
3201cb0ef41Sopenharmony_ci<code>https://example.com/example-1.3.0.tgz</code>)</li>
3211cb0ef41Sopenharmony_ci<li>local tarball sources: This is the file URL of the tarball. (eg
3221cb0ef41Sopenharmony_ci<code>file:///opt/storage/example-1.3.0.tgz</code>)</li>
3231cb0ef41Sopenharmony_ci<li>local link sources: This is the file URL of the link. (eg
3241cb0ef41Sopenharmony_ci<code>file:libs/our-module</code>)</li>
3251cb0ef41Sopenharmony_ci</ul>
3261cb0ef41Sopenharmony_ci</li>
3271cb0ef41Sopenharmony_ci<li>
3281cb0ef41Sopenharmony_ci<p>integrity: A <code>sha512</code> or <code>sha1</code> <a href="https://w3c.github.io/webappsec/specs/subresourceintegrity/">Standard Subresource
3291cb0ef41Sopenharmony_ciIntegrity</a>
3301cb0ef41Sopenharmony_cistring for the artifact that was unpacked in this location.  For git
3311cb0ef41Sopenharmony_cidependencies, this is the commit sha.</p>
3321cb0ef41Sopenharmony_ci</li>
3331cb0ef41Sopenharmony_ci<li>
3341cb0ef41Sopenharmony_ci<p>resolved: For registry sources this is path of the tarball relative to
3351cb0ef41Sopenharmony_cithe registry URL.  If the tarball URL isn't on the same server as the
3361cb0ef41Sopenharmony_ciregistry URL then this is a complete URL. <code>registry.npmjs.org</code> is a magic
3371cb0ef41Sopenharmony_civalue meaning "the currently configured registry".</p>
3381cb0ef41Sopenharmony_ci</li>
3391cb0ef41Sopenharmony_ci<li>
3401cb0ef41Sopenharmony_ci<p>bundled:  If true, this is the bundled dependency and will be installed
3411cb0ef41Sopenharmony_ciby the parent module.  When installing, this module will be extracted
3421cb0ef41Sopenharmony_cifrom the parent module during the extract phase, not installed as a
3431cb0ef41Sopenharmony_ciseparate dependency.</p>
3441cb0ef41Sopenharmony_ci</li>
3451cb0ef41Sopenharmony_ci<li>
3461cb0ef41Sopenharmony_ci<p>dev: If true then this dependency is either a development dependency ONLY
3471cb0ef41Sopenharmony_ciof the top level module or a transitive dependency of one.  This is false
3481cb0ef41Sopenharmony_cifor dependencies that are both a development dependency of the top level
3491cb0ef41Sopenharmony_ciand a transitive dependency of a non-development dependency of the top
3501cb0ef41Sopenharmony_cilevel.</p>
3511cb0ef41Sopenharmony_ci</li>
3521cb0ef41Sopenharmony_ci<li>
3531cb0ef41Sopenharmony_ci<p>optional: If true then this dependency is either an optional dependency
3541cb0ef41Sopenharmony_ciONLY of the top level module or a transitive dependency of one.  This is
3551cb0ef41Sopenharmony_cifalse for dependencies that are both an optional dependency of the top
3561cb0ef41Sopenharmony_cilevel and a transitive dependency of a non-optional dependency of the top
3571cb0ef41Sopenharmony_cilevel.</p>
3581cb0ef41Sopenharmony_ci</li>
3591cb0ef41Sopenharmony_ci<li>
3601cb0ef41Sopenharmony_ci<p>requires: This is a mapping of module name to version.  This is a list of
3611cb0ef41Sopenharmony_cieverything this module requires, regardless of where it will be
3621cb0ef41Sopenharmony_ciinstalled.  The version should match via normal matching rules a
3631cb0ef41Sopenharmony_cidependency either in our <code>dependencies</code> or in a level higher than us.</p>
3641cb0ef41Sopenharmony_ci</li>
3651cb0ef41Sopenharmony_ci<li>
3661cb0ef41Sopenharmony_ci<p>dependencies: The dependencies of this dependency, exactly as at the top
3671cb0ef41Sopenharmony_cilevel.</p>
3681cb0ef41Sopenharmony_ci</li>
3691cb0ef41Sopenharmony_ci</ul>
3701cb0ef41Sopenharmony_ci<h3 id="see-also">See also</h3>
3711cb0ef41Sopenharmony_ci<ul>
3721cb0ef41Sopenharmony_ci<li><a href="../commands/npm-shrinkwrap.html">npm shrinkwrap</a></li>
3731cb0ef41Sopenharmony_ci<li><a href="../configuring-npm/npm-shrinkwrap-json.html">npm-shrinkwrap.json</a></li>
3741cb0ef41Sopenharmony_ci<li><a href="../configuring-npm/package-json.html">package.json</a></li>
3751cb0ef41Sopenharmony_ci<li><a href="../commands/npm-install.html">npm install</a></li>
3761cb0ef41Sopenharmony_ci</ul></div>
3771cb0ef41Sopenharmony_ci
3781cb0ef41Sopenharmony_ci<footer id="edit">
3791cb0ef41Sopenharmony_ci<a href="https://github.com/npm/cli/edit/latest/docs/content/configuring-npm/package-lock-json.md">
3801cb0ef41Sopenharmony_ci<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;">
3811cb0ef41Sopenharmony_ci<path fill-rule="evenodd" d="M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 000-.354l-1.086-1.086zM11.189 6.25L9.75 4.81l-6.286 6.287a.25.25 0 00-.064.108l-.558 1.953 1.953-.558a.249.249 0 00.108-.064l6.286-6.286z"></path>
3821cb0ef41Sopenharmony_ci</svg>
3831cb0ef41Sopenharmony_ciEdit this page on GitHub
3841cb0ef41Sopenharmony_ci</a>
3851cb0ef41Sopenharmony_ci</footer>
3861cb0ef41Sopenharmony_ci</section>
3871cb0ef41Sopenharmony_ci
3881cb0ef41Sopenharmony_ci
3891cb0ef41Sopenharmony_ci
3901cb0ef41Sopenharmony_ci</body></html>