/usr/share/doc/nodejs-docs/doc/api
{ "type": "module", "source": "doc/api/corepack.md", "introduced_in": "v16.9.0", "meta": { "added": [ "v16.9.0", "v14.19.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "miscs": [ { "textRaw": "Corepack", "name": "Corepack", "introduced_in": "v16.9.0", "type": "misc", "meta": { "added": [ "v16.9.0", "v14.19.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "desc": "<p><em><a href=\"https://github.com/nodejs/corepack\">Corepack</a></em> is an experimental tool to help with\nmanaging versions of your package managers. It exposes binary proxies for\neach <a href=\"#supported-package-managers\">supported package manager</a> that, when called, will identify whatever\npackage manager is configured for the current project, transparently install\nit if needed, and finally run it without requiring explicit user interactions.</p>\n<p>This feature simplifies two core workflows:</p>\n<ul>\n<li>\n<p>It eases new contributor onboarding, since they won't have to follow\nsystem-specific installation processes anymore just to have the package\nmanager you want them to.</p>\n</li>\n<li>\n<p>It allows you to ensure that everyone in your team will use exactly the\npackage manager version you intend them to, without them having to\nmanually synchronize it each time you need to make an update.</p>\n</li>\n</ul>", "miscs": [ { "textRaw": "Workflows", "name": "workflows", "modules": [ { "textRaw": "Enabling the feature", "name": "enabling_the_feature", "desc": "<p>Due to its experimental status, Corepack currently needs to be explicitly\nenabled to have any effect. To do that, run <a href=\"https://github.com/nodejs/corepack#corepack-enable--name\"><code>corepack enable</code></a>, which\nwill set up the symlinks in your environment next to the <code>node</code> binary\n(and overwrite the existing symlinks if necessary).</p>\n<p>From this point forward, any call to the <a href=\"#supported-package-managers\">supported binaries</a> will work\nwithout further setup. Should you experience a problem, run\n<a href=\"https://github.com/nodejs/corepack#corepack-disable--name\"><code>corepack disable</code></a> to remove the proxies from your system (and consider\nopening an issue on the <a href=\"https://github.com/nodejs/corepack\">Corepack repository</a> to let us know).</p>", "type": "module", "displayName": "Enabling the feature" }, { "textRaw": "Configuring a package", "name": "configuring_a_package", "desc": "<p>The Corepack proxies will find the closest <a href=\"packages.html#nodejs-packagejson-field-definitions\"><code>package.json</code></a> file in your\ncurrent directory hierarchy to extract its <a href=\"packages.html#packagemanager\"><code>\"packageManager\"</code></a> property.</p>\n<p>If the value corresponds to a <a href=\"#supported-package-managers\">supported package manager</a>, Corepack will make\nsure that all calls to the relevant binaries are run against the requested\nversion, downloading it on demand if needed, and aborting if it cannot be\nsuccessfully retrieved.</p>", "type": "module", "displayName": "Configuring a package" }, { "textRaw": "Upgrading the global versions", "name": "upgrading_the_global_versions", "desc": "<p>When running outside of an existing project (for example when running\n<code>yarn init</code>), Corepack will by default use predefined versions roughly\ncorresponding to the latest stable releases from each tool. Those versions can\nbe overridden by running the <a href=\"https://github.com/nodejs/corepack#corepack-prepare--nameversion\"><code>corepack prepare</code></a> command along with the\npackage manager version you wish to set:</p>\n<pre><code class=\"language-bash\">corepack prepare yarn@x.y.z --activate\n</code></pre>", "type": "module", "displayName": "Upgrading the global versions" }, { "textRaw": "Offline workflow", "name": "offline_workflow", "desc": "<p>Many production environments don't have network access. Since Corepack\nusually downloads the package manager releases straight from their registries,\nit can conflict with such environments. To avoid that happening, call the\n<a href=\"https://github.com/nodejs/corepack#corepack-prepare--nameversion\"><code>corepack prepare</code></a> command while you still have network access (typically at\nthe same time you're preparing your deploy image). This will ensure that the\nrequired package managers are available even without network access.</p>\n<p>The <code>prepare</code> command has <a href=\"https://github.com/nodejs/corepack#utility-commands\">various flags</a>. Consult the detailed\n<a href=\"https://github.com/nodejs/corepack#readme\">Corepack documentation</a> for more information.</p>", "type": "module", "displayName": "Offline workflow" } ], "type": "misc", "displayName": "Workflows" }, { "textRaw": "Supported package managers", "name": "supported_package_managers", "desc": "<p>The following binaries are provided through Corepack:</p>\n<table>\n<thead>\n<tr>\n<th>Package manager</th>\n<th>Binary names</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><a href=\"https://yarnpkg.com\">Yarn</a></td>\n<td><code>yarn</code>, <code>yarnpkg</code></td>\n</tr>\n<tr>\n<td><a href=\"https://pnpm.js.org\">pnpm</a></td>\n<td><code>pnpm</code>, <code>pnpx</code></td>\n</tr>\n</tbody>\n</table>", "type": "misc", "displayName": "Supported package managers" }, { "textRaw": "Common questions", "name": "common_questions", "modules": [ { "textRaw": "How does Corepack interact with npm?", "name": "how_does_corepack_interact_with_npm?", "desc": "<p>While Corepack could support npm like any other package manager, its\nshims aren't enabled by default. This has a few consequences:</p>\n<ul>\n<li>\n<p>It's always possible to run a <code>npm</code> command within a project configured to\nbe used with another package manager, since Corepack cannot intercept it.</p>\n</li>\n<li>\n<p>While <code>npm</code> is a valid option in the <a href=\"packages.html#packagemanager\"><code>\"packageManager\"</code></a> property, the\nlack of shim will cause the global npm to be used.</p>\n</li>\n</ul>", "type": "module", "displayName": "How does Corepack interact with npm?" }, { "textRaw": "Running `npm install -g yarn` doesn't work", "name": "running_`npm_install_-g_yarn`_doesn't_work", "desc": "<p>npm prevents accidentally overriding the Corepack binaries when doing a global\ninstall. To avoid this problem, consider one of the following options:</p>\n<ul>\n<li>\n<p>Don't run this command; Corepack will provide the package manager\nbinaries anyway and will ensure that the requested versions are always\navailable, so installing the package managers explicitly isn't needed.</p>\n</li>\n<li>\n<p>Add the <code>--force</code> flag to <code>npm install</code>; this will tell npm that it's fine to\noverride binaries, but you'll erase the Corepack ones in the process. (Run\n<a href=\"https://github.com/nodejs/corepack#corepack-enable--name\"><code>corepack enable</code></a> to add them back.)</p>\n</li>\n</ul>", "type": "module", "displayName": "Running `npm install -g yarn` doesn't work" } ], "type": "misc", "displayName": "Common questions" } ] } ] }
.
Edit
..
Edit
addons.html
Edit
addons.json
Edit
addons.md
Edit
all.html
Edit
all.json
Edit
assert.html
Edit
assert.json
Edit
assert.md
Edit
assets
Edit
async_context.html
Edit
async_context.json
Edit
async_context.md
Edit
async_hooks.html
Edit
async_hooks.json
Edit
async_hooks.md
Edit
buffer.html
Edit
buffer.json
Edit
buffer.md
Edit
child_process.html
Edit
child_process.json
Edit
child_process.md
Edit
cli.html
Edit
cli.json
Edit
cli.md
Edit
cluster.html
Edit
cluster.json
Edit
cluster.md
Edit
console.html
Edit
console.json
Edit
console.md
Edit
corepack.html
Edit
corepack.json
Edit
corepack.md
Edit
crypto.html
Edit
crypto.json
Edit
crypto.md
Edit
debugger.html
Edit
debugger.json
Edit
debugger.md
Edit
deprecations.html
Edit
deprecations.json
Edit
deprecations.md
Edit
dgram.html
Edit
dgram.json
Edit
dgram.md
Edit
diagnostics_channel.html
Edit
diagnostics_channel.json
Edit
diagnostics_channel.md
Edit
dns.html
Edit
dns.json
Edit
dns.md
Edit
documentation.html
Edit
documentation.json
Edit
documentation.md
Edit
domain.html
Edit
domain.json
Edit
domain.md
Edit
embedding.html
Edit
embedding.json
Edit
embedding.md
Edit
errors.html
Edit
errors.json
Edit
errors.md
Edit
esm.html
Edit
esm.json
Edit
esm.md
Edit
events.html
Edit
events.json
Edit
events.md
Edit
fs.html
Edit
fs.json
Edit
fs.md
Edit
globals.html
Edit
globals.json
Edit
globals.md
Edit
http.html
Edit
http.json
Edit
http.md
Edit
http2.html
Edit
http2.json
Edit
http2.md
Edit
https.html
Edit
https.json
Edit
https.md
Edit
index.html
Edit
index.json
Edit
index.md
Edit
inspector.html
Edit
inspector.json
Edit
inspector.md
Edit
intl.html
Edit
intl.json
Edit
intl.md
Edit
module.html
Edit
module.json
Edit
module.md
Edit
modules.html
Edit
modules.json
Edit
modules.md
Edit
n-api.html
Edit
n-api.json
Edit
n-api.md
Edit
net.html
Edit
net.json
Edit
net.md
Edit
os.html
Edit
os.json
Edit
os.md
Edit
packages.html
Edit
packages.json
Edit
packages.md
Edit
path.html
Edit
path.json
Edit
path.md
Edit
perf_hooks.html
Edit
perf_hooks.json
Edit
perf_hooks.md
Edit
permissions.html
Edit
permissions.json
Edit
permissions.md
Edit
policy.html
Edit
policy.json
Edit
policy.md
Edit
process.html
Edit
process.json
Edit
process.md
Edit
punycode.html
Edit
punycode.json
Edit
punycode.md
Edit
querystring.html
Edit
querystring.json
Edit
querystring.md
Edit
readline.html
Edit
readline.json
Edit
readline.md
Edit
repl.html
Edit
repl.json
Edit
repl.md
Edit
report.html
Edit
report.json
Edit
report.md
Edit
stream.html
Edit
stream.json
Edit
stream.md
Edit
string_decoder.html
Edit
string_decoder.json
Edit
string_decoder.md
Edit
synopsis.html
Edit
synopsis.json
Edit
synopsis.md
Edit
test.html
Edit
test.json
Edit
test.md
Edit
timers.html
Edit
timers.json
Edit
timers.md
Edit
tls.html
Edit
tls.json
Edit
tls.md
Edit
tracing.html
Edit
tracing.json
Edit
tracing.md
Edit
tty.html
Edit
tty.json
Edit
tty.md
Edit
url.html
Edit
url.json
Edit
url.md
Edit
util.html
Edit
util.json
Edit
util.md
Edit
v8.html
Edit
v8.json
Edit
v8.md
Edit
vm.html
Edit
vm.json
Edit
vm.md
Edit
wasi.html
Edit
wasi.json
Edit
wasi.md
Edit
webcrypto.html
Edit
webcrypto.json
Edit
webcrypto.md
Edit
webstreams.html
Edit
webstreams.json
Edit
webstreams.md
Edit
worker_threads.html
Edit
worker_threads.json
Edit
worker_threads.md
Edit
zlib.html
Edit
zlib.json
Edit
zlib.md
Edit