11cb0ef41Sopenharmony_ci<!DOCTYPE html><html><head> 21cb0ef41Sopenharmony_ci<meta charset="utf-8"> 31cb0ef41Sopenharmony_ci<title>npm-pkg</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="npm-pkg">npm-pkg</h1> 1401cb0ef41Sopenharmony_ci<span class="description">Manages your package.json</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="#see-also">See Also</a></li></ul></div> 1461cb0ef41Sopenharmony_ci</section> 1471cb0ef41Sopenharmony_ci 1481cb0ef41Sopenharmony_ci<div id="_content"><h3 id="synopsis">Synopsis</h3> 1491cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg set <key>=<value> [<key>=<value> ...] 1501cb0ef41Sopenharmony_cinpm pkg get [<key> [<key> ...]] 1511cb0ef41Sopenharmony_cinpm pkg delete <key> [<key> ...] 1521cb0ef41Sopenharmony_cinpm pkg set [<array>[<index>].<key>=<value> ...] 1531cb0ef41Sopenharmony_cinpm pkg set [<array>[].<key>=<value> ...] 1541cb0ef41Sopenharmony_cinpm pkg fix 1551cb0ef41Sopenharmony_ci</code></pre> 1561cb0ef41Sopenharmony_ci<h3 id="description">Description</h3> 1571cb0ef41Sopenharmony_ci<p>A command that automates the management of <code>package.json</code> files. 1581cb0ef41Sopenharmony_ci<code>npm pkg</code> provide 3 different sub commands that allow you to modify or retrieve 1591cb0ef41Sopenharmony_civalues for given object keys in your <code>package.json</code>.</p> 1601cb0ef41Sopenharmony_ci<p>The syntax to retrieve and set fields is a dot separated representation of 1611cb0ef41Sopenharmony_cithe nested object properties to be found within your <code>package.json</code>, it's the 1621cb0ef41Sopenharmony_cisame notation used in <a href="../commands/npm-view.html"><code>npm view</code></a> to retrieve information 1631cb0ef41Sopenharmony_cifrom the registry manifest, below you can find more examples on how to use it.</p> 1641cb0ef41Sopenharmony_ci<p>Returned values are always in <strong>json</strong> format.</p> 1651cb0ef41Sopenharmony_ci<ul> 1661cb0ef41Sopenharmony_ci<li> 1671cb0ef41Sopenharmony_ci<p><code>npm pkg get <field></code></p> 1681cb0ef41Sopenharmony_ci<p>Retrieves a value <code>key</code>, defined in your <code>package.json</code> file.</p> 1691cb0ef41Sopenharmony_ci<p>For example, in order to retrieve the name of the current package, you 1701cb0ef41Sopenharmony_cican run:</p> 1711cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg get name 1721cb0ef41Sopenharmony_ci</code></pre> 1731cb0ef41Sopenharmony_ci<p>It's also possible to retrieve multiple values at once:</p> 1741cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg get name version 1751cb0ef41Sopenharmony_ci</code></pre> 1761cb0ef41Sopenharmony_ci<p>You can view child fields by separating them with a period. To retrieve 1771cb0ef41Sopenharmony_cithe value of a test <code>script</code> value, you would run the following command:</p> 1781cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg get scripts.test 1791cb0ef41Sopenharmony_ci</code></pre> 1801cb0ef41Sopenharmony_ci<p>For fields that are arrays, requesting a non-numeric field will return 1811cb0ef41Sopenharmony_ciall of the values from the objects in the list. For example, to get all 1821cb0ef41Sopenharmony_cithe contributor emails for a package, you would run:</p> 1831cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg get contributors.email 1841cb0ef41Sopenharmony_ci</code></pre> 1851cb0ef41Sopenharmony_ci<p>You may also use numeric indices in square braces to specifically select 1861cb0ef41Sopenharmony_cian item in an array field. To just get the email address of the first 1871cb0ef41Sopenharmony_cicontributor in the list, you can run:</p> 1881cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg get contributors[0].email 1891cb0ef41Sopenharmony_ci</code></pre> 1901cb0ef41Sopenharmony_ci<p>For complex fields you can also name a property in square brackets 1911cb0ef41Sopenharmony_cito specifically select a child field. This is especially helpful 1921cb0ef41Sopenharmony_ciwith the exports object:</p> 1931cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg get "exports[.].require" 1941cb0ef41Sopenharmony_ci</code></pre> 1951cb0ef41Sopenharmony_ci</li> 1961cb0ef41Sopenharmony_ci<li> 1971cb0ef41Sopenharmony_ci<p><code>npm pkg set <field>=<value></code></p> 1981cb0ef41Sopenharmony_ci<p>Sets a <code>value</code> in your <code>package.json</code> based on the <code>field</code> value. When 1991cb0ef41Sopenharmony_cisaving to your <code>package.json</code> file the same set of rules used during 2001cb0ef41Sopenharmony_ci<code>npm install</code> and other cli commands that touches the <code>package.json</code> file 2011cb0ef41Sopenharmony_ciare used, making sure to respect the existing indentation and possibly 2021cb0ef41Sopenharmony_ciapplying some validation prior to saving values to the file.</p> 2031cb0ef41Sopenharmony_ci<p>The same syntax used to retrieve values from your package can also be used 2041cb0ef41Sopenharmony_cito define new properties or overriding existing ones, below are some 2051cb0ef41Sopenharmony_ciexamples of how the dot separated syntax can be used to edit your 2061cb0ef41Sopenharmony_ci<code>package.json</code> file.</p> 2071cb0ef41Sopenharmony_ci<p>Defining a new bin named <code>mynewcommand</code> in your <code>package.json</code> that points 2081cb0ef41Sopenharmony_cito a file <code>cli.js</code>:</p> 2091cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg set bin.mynewcommand=cli.js 2101cb0ef41Sopenharmony_ci</code></pre> 2111cb0ef41Sopenharmony_ci<p>Setting multiple fields at once is also possible:</p> 2121cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg set description='Awesome package' engines.node='>=10' 2131cb0ef41Sopenharmony_ci</code></pre> 2141cb0ef41Sopenharmony_ci<p>It's also possible to add to array values, for example to add a new 2151cb0ef41Sopenharmony_cicontributor entry:</p> 2161cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg set contributors[0].name='Foo' contributors[0].email='foo@bar.ca' 2171cb0ef41Sopenharmony_ci</code></pre> 2181cb0ef41Sopenharmony_ci<p>You may also append items to the end of an array using the special 2191cb0ef41Sopenharmony_ciempty bracket notation:</p> 2201cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg set contributors[].name='Foo' contributors[].name='Bar' 2211cb0ef41Sopenharmony_ci</code></pre> 2221cb0ef41Sopenharmony_ci<p>It's also possible to parse values as json prior to saving them to your 2231cb0ef41Sopenharmony_ci<code>package.json</code> file, for example in order to set a <code>"private": true</code> 2241cb0ef41Sopenharmony_ciproperty:</p> 2251cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg set private=true --json 2261cb0ef41Sopenharmony_ci</code></pre> 2271cb0ef41Sopenharmony_ci<p>It also enables saving values as numbers:</p> 2281cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg set tap.timeout=60 --json 2291cb0ef41Sopenharmony_ci</code></pre> 2301cb0ef41Sopenharmony_ci</li> 2311cb0ef41Sopenharmony_ci<li> 2321cb0ef41Sopenharmony_ci<p><code>npm pkg delete <key></code></p> 2331cb0ef41Sopenharmony_ci<p>Deletes a <code>key</code> from your <code>package.json</code></p> 2341cb0ef41Sopenharmony_ci<p>The same syntax used to set values from your package can also be used 2351cb0ef41Sopenharmony_cito remove existing ones. For example, in order to remove a script named 2361cb0ef41Sopenharmony_cibuild:</p> 2371cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg delete scripts.build 2381cb0ef41Sopenharmony_ci</code></pre> 2391cb0ef41Sopenharmony_ci</li> 2401cb0ef41Sopenharmony_ci<li> 2411cb0ef41Sopenharmony_ci<p><code>npm pkg fix</code></p> 2421cb0ef41Sopenharmony_ci<p>Auto corrects common errors in your <code>package.json</code>. npm already 2431cb0ef41Sopenharmony_cidoes this during <code>publish</code>, which leads to subtle (mostly harmless) 2441cb0ef41Sopenharmony_cidifferences between the contents of your <code>package.json</code> file and the 2451cb0ef41Sopenharmony_cimanifest that npm uses during installation.</p> 2461cb0ef41Sopenharmony_ci</li> 2471cb0ef41Sopenharmony_ci</ul> 2481cb0ef41Sopenharmony_ci<h3 id="workspaces-support">Workspaces support</h3> 2491cb0ef41Sopenharmony_ci<p>You can set/get/delete items across your configured workspaces by using the 2501cb0ef41Sopenharmony_ci<a href="../using-npm/config#workspace.html"><code>workspace</code></a> or 2511cb0ef41Sopenharmony_ci<a href="../using-npm/config#workspaces.html"><code>workspaces</code></a> config options.</p> 2521cb0ef41Sopenharmony_ci<p>For example, setting a <code>funding</code> value across all configured workspaces 2531cb0ef41Sopenharmony_ciof a project:</p> 2541cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm pkg set funding=https://example.com --ws 2551cb0ef41Sopenharmony_ci</code></pre> 2561cb0ef41Sopenharmony_ci<p>When using <code>npm pkg get</code> to retrieve info from your configured workspaces, the 2571cb0ef41Sopenharmony_cireturned result will be in a json format in which top level keys are the 2581cb0ef41Sopenharmony_cinames of each workspace, the values of these keys will be the result values 2591cb0ef41Sopenharmony_cireturned from each of the configured workspaces, e.g:</p> 2601cb0ef41Sopenharmony_ci<pre><code>npm pkg get name version --ws 2611cb0ef41Sopenharmony_ci{ 2621cb0ef41Sopenharmony_ci "a": { 2631cb0ef41Sopenharmony_ci "name": "a", 2641cb0ef41Sopenharmony_ci "version": "1.0.0" 2651cb0ef41Sopenharmony_ci }, 2661cb0ef41Sopenharmony_ci "b": { 2671cb0ef41Sopenharmony_ci "name": "b", 2681cb0ef41Sopenharmony_ci "version": "1.0.0" 2691cb0ef41Sopenharmony_ci } 2701cb0ef41Sopenharmony_ci} 2711cb0ef41Sopenharmony_ci</code></pre> 2721cb0ef41Sopenharmony_ci<h3 id="configuration">Configuration</h3> 2731cb0ef41Sopenharmony_ci<h4 id="force"><code>force</code></h4> 2741cb0ef41Sopenharmony_ci<ul> 2751cb0ef41Sopenharmony_ci<li>Default: false</li> 2761cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 2771cb0ef41Sopenharmony_ci</ul> 2781cb0ef41Sopenharmony_ci<p>Removes various protections against unfortunate side effects, common 2791cb0ef41Sopenharmony_cimistakes, unnecessary performance degradation, and malicious input.</p> 2801cb0ef41Sopenharmony_ci<ul> 2811cb0ef41Sopenharmony_ci<li>Allow clobbering non-npm files in global installs.</li> 2821cb0ef41Sopenharmony_ci<li>Allow the <code>npm version</code> command to work on an unclean git repository.</li> 2831cb0ef41Sopenharmony_ci<li>Allow deleting the cache folder with <code>npm cache clean</code>.</li> 2841cb0ef41Sopenharmony_ci<li>Allow installing packages that have an <code>engines</code> declaration requiring a 2851cb0ef41Sopenharmony_cidifferent version of npm.</li> 2861cb0ef41Sopenharmony_ci<li>Allow installing packages that have an <code>engines</code> declaration requiring a 2871cb0ef41Sopenharmony_cidifferent version of <code>node</code>, even if <code>--engine-strict</code> is enabled.</li> 2881cb0ef41Sopenharmony_ci<li>Allow <code>npm audit fix</code> to install modules outside your stated dependency 2891cb0ef41Sopenharmony_cirange (including SemVer-major changes).</li> 2901cb0ef41Sopenharmony_ci<li>Allow unpublishing all versions of a published package.</li> 2911cb0ef41Sopenharmony_ci<li>Allow conflicting peerDependencies to be installed in the root project.</li> 2921cb0ef41Sopenharmony_ci<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li> 2931cb0ef41Sopenharmony_ci<li>Allow clobbering existing values in <code>npm pkg</code></li> 2941cb0ef41Sopenharmony_ci<li>Allow unpublishing of entire packages (not just a single version).</li> 2951cb0ef41Sopenharmony_ci</ul> 2961cb0ef41Sopenharmony_ci<p>If you don't have a clear idea of what you want to do, it is strongly 2971cb0ef41Sopenharmony_cirecommended that you do not use this option!</p> 2981cb0ef41Sopenharmony_ci<h4 id="json"><code>json</code></h4> 2991cb0ef41Sopenharmony_ci<ul> 3001cb0ef41Sopenharmony_ci<li>Default: false</li> 3011cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 3021cb0ef41Sopenharmony_ci</ul> 3031cb0ef41Sopenharmony_ci<p>Whether or not to output JSON data, rather than the normal output.</p> 3041cb0ef41Sopenharmony_ci<ul> 3051cb0ef41Sopenharmony_ci<li>In <code>npm pkg set</code> it enables parsing set values with JSON.parse() before 3061cb0ef41Sopenharmony_cisaving them to your <code>package.json</code>.</li> 3071cb0ef41Sopenharmony_ci</ul> 3081cb0ef41Sopenharmony_ci<p>Not supported by all npm commands.</p> 3091cb0ef41Sopenharmony_ci<h4 id="workspace"><code>workspace</code></h4> 3101cb0ef41Sopenharmony_ci<ul> 3111cb0ef41Sopenharmony_ci<li>Default:</li> 3121cb0ef41Sopenharmony_ci<li>Type: String (can be set multiple times)</li> 3131cb0ef41Sopenharmony_ci</ul> 3141cb0ef41Sopenharmony_ci<p>Enable running a command in the context of the configured workspaces of the 3151cb0ef41Sopenharmony_cicurrent project while filtering by running only the workspaces defined by 3161cb0ef41Sopenharmony_cithis configuration option.</p> 3171cb0ef41Sopenharmony_ci<p>Valid values for the <code>workspace</code> config are either:</p> 3181cb0ef41Sopenharmony_ci<ul> 3191cb0ef41Sopenharmony_ci<li>Workspace names</li> 3201cb0ef41Sopenharmony_ci<li>Path to a workspace directory</li> 3211cb0ef41Sopenharmony_ci<li>Path to a parent workspace directory (will result in selecting all 3221cb0ef41Sopenharmony_ciworkspaces within that folder)</li> 3231cb0ef41Sopenharmony_ci</ul> 3241cb0ef41Sopenharmony_ci<p>When set for the <code>npm init</code> command, this may be set to the folder of a 3251cb0ef41Sopenharmony_ciworkspace which does not yet exist, to create the folder and set it up as a 3261cb0ef41Sopenharmony_cibrand new workspace within the project.</p> 3271cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p> 3281cb0ef41Sopenharmony_ci<h4 id="workspaces"><code>workspaces</code></h4> 3291cb0ef41Sopenharmony_ci<ul> 3301cb0ef41Sopenharmony_ci<li>Default: null</li> 3311cb0ef41Sopenharmony_ci<li>Type: null or Boolean</li> 3321cb0ef41Sopenharmony_ci</ul> 3331cb0ef41Sopenharmony_ci<p>Set to true to run the command in the context of <strong>all</strong> configured 3341cb0ef41Sopenharmony_ciworkspaces.</p> 3351cb0ef41Sopenharmony_ci<p>Explicitly setting this to false will cause commands like <code>install</code> to 3361cb0ef41Sopenharmony_ciignore workspaces altogether. When not set explicitly:</p> 3371cb0ef41Sopenharmony_ci<ul> 3381cb0ef41Sopenharmony_ci<li>Commands that operate on the <code>node_modules</code> tree (install, update, etc.) 3391cb0ef41Sopenharmony_ciwill link workspaces into the <code>node_modules</code> folder. - Commands that do 3401cb0ef41Sopenharmony_ciother things (test, exec, publish, etc.) will operate on the root project, 3411cb0ef41Sopenharmony_ci<em>unless</em> one or more workspaces are specified in the <code>workspace</code> config.</li> 3421cb0ef41Sopenharmony_ci</ul> 3431cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p> 3441cb0ef41Sopenharmony_ci<h2 id="see-also">See Also</h2> 3451cb0ef41Sopenharmony_ci<ul> 3461cb0ef41Sopenharmony_ci<li><a href="../commands/npm-install.html">npm install</a></li> 3471cb0ef41Sopenharmony_ci<li><a href="../commands/npm-init.html">npm init</a></li> 3481cb0ef41Sopenharmony_ci<li><a href="../commands/npm-config.html">npm config</a></li> 3491cb0ef41Sopenharmony_ci<li><a href="../using-npm/workspaces.html">workspaces</a></li> 3501cb0ef41Sopenharmony_ci</ul></div> 3511cb0ef41Sopenharmony_ci 3521cb0ef41Sopenharmony_ci<footer id="edit"> 3531cb0ef41Sopenharmony_ci<a href="https://github.com/npm/cli/edit/latest/docs/content/commands/npm-pkg.md"> 3541cb0ef41Sopenharmony_ci<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;"> 3551cb0ef41Sopenharmony_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> 3561cb0ef41Sopenharmony_ci</svg> 3571cb0ef41Sopenharmony_ciEdit this page on GitHub 3581cb0ef41Sopenharmony_ci</a> 3591cb0ef41Sopenharmony_ci</footer> 3601cb0ef41Sopenharmony_ci</section> 3611cb0ef41Sopenharmony_ci 3621cb0ef41Sopenharmony_ci 3631cb0ef41Sopenharmony_ci 3641cb0ef41Sopenharmony_ci</body></html>