@yarnpkg/shell
4.1.4 · 21 Nov 2026BSD-2-Clause1.2M / weekRepositorynpmAtom feed
4.1.4 is the newest release of 4.x.
In short
2 breaking7 removed4 new2 fixed42 changed
- Breaking
With Node.js 16's now being End of Life'd, we dropped support for Node.js versions lower than 18.12.
- Breaking
All official Yarn plugins are now included by default in the bundle we provide. You no longer need to run
yarn plugin importfor official plugins (you still need to do it for third-party plugins, of course). - Removed
preferAggregateCacheInfohas been removed (it's now always on) - Removed
pnpDataPathhas been removed to adhere to our new PnP specification. For consistency, all PnP files will now be hardcoded to a single value so that third-party tools can implement the PnP specification without relying on the Yarn configuration. - Removed
MapConfigurationValuehas been removed. UsemiscUtils.ToMapValueinstead. - Removed
workspace.dependencieshas been removed. Useworkspace.anchoredPackage.dependenciesinstead. - Removed
startCacheReporthas been removed, and is now part of the output generated byfetchEverything. - Removed
configuration.{packageExtensions,refreshPackageExtensions}have been removed. Useconfiguration.getPackageExtensionsinstead.
Release note
Major Changes
- Breaking
With Node.js 16's now being End of Life'd, we dropped support for Node.js versions lower than 18.12.
- Breaking
Some important defaults have changed:
yarn initandyarn set versionwill prefer usingpackageManagerrather thanyarnPathwhen possible (when they detectCOREPACK_ROOTin your environment variables).yarn initwill no longer use zero-install by default. You still can enable it, but it should make it easier to start one-of projects without having to rewrite the configuration afterwards.As a result,
enableGlobalCachenow defaults totrue. If your project uses Zero-Installs, the firstyarn installyou run after migrating to 4.0 will automatically setenableGlobalCache: falsein your local.yarnrc.yml.
yarn workspaces foreachnow requires one of--all,--recursive,--since, or--worktreeto be explicitly specified; the previous default was--worktree, but it was rarely what users expected.compressionLevelnow defaults to0rather thanmixed. It's been proved significantly faster on installs, and the size impact was reasonable enough to change the default. Note that it benefits you even if you use Zero-Installs: as per our tests, a zero-compression is actually easier to handle for Git (you can see by yourself with those examples usingcompressionLevel: 0vscompressionLevel: mixed).To avoid making the upgrade too disruptive, Yarn will check whether Zero-Installs are enabled the first time you run
yarn installafter migrating from 3.6 to 4.0. If you do, it will automatically set the old default (compressionLevel: mixed) in your.yarnrc.ymlfile. You can then remove it whenever you feel ready to actually change the compression settings.
- Breaking
All official Yarn plugins are now included by default in the bundle we provide. You no longer need to run
yarn plugin importfor official plugins (you still need to do it for third-party plugins, of course).This doesn't change anything to the plugin API we provide, which will keep being maintained.
Yarn still has a modular architecture and uses the exact same APIs as contrib plugins; all that changes is how we distribute our own features.
- Breaking
Yarn's UI during installs has been greatly improved:
Packages added and removed from the lockfile are now explicitly reported.
Fluctuations in the project cache size are now reported as a single line.
Unactionable warnings (
node-gypand transitive peer dependency errors) have been removed.Skipped builds are now only reported during initial installs and manual
yarn rebuildcalls.The Yarn version is now displayed on installs to help us investigate issues when reported as screenshots.
Deprecation checks have been moved to
yarn npm audit.
- Breaking
Some settings were renamed or removed:
caFilePathis nowhttpsCaFilePathpreferAggregateCacheInfohas been removed (it's now always on)pnpDataPathhas been removed to adhere to our new PnP specification. For consistency, all PnP files will now be hardcoded to a single value so that third-party tools can implement the PnP specification without relying on the Yarn configuration.
- Breaking
The
yarn npm auditcommand has been reimplemented:The audit registry must now implement the
/-/npm/v1/security/advisories/bulkendpoint.The
npmAuditRegistrycan be used to temporarily route audit queries to the npm registry.Deprecations are now returned by default. To silence them, use
yarn npm audit ! --no-deprecations.
- Breaking
Some legacy layers have been sunset:
Plugins cannot access the Clipanion 2 APIs anymore (upgrade to Clipanion 3)
Plugins cannot access the internal copy of Yup anymore (use Typanion instead)
Yarn will no longer remove the old Yarn 2.x
.pnp.jsfile when migrating.The
--assume-fresh-projectflag ofyarn inithas been removed.
API Changes
The following changes only affect people writing Yarn plugins:
The
ZipFSandZipOpenFSclasses have been moved from@yarnpkg/fslibto@yarnpkg/libzip. They no longer need or accept thelibzipparameter.Reading the zip archives is now done on the Node.js side for performance; as a result, the
open,ZIP_CREATE, andZIP_TRUNCATEbindings are no longer needed forZipFSand have also been removed.
The
dependenciesfield sent returned byResolver#resolvemust now be the result of aConfiguration#normalizeDependencyMapcall. This change is prompted by a refactoring of how default protocols (ienpm:) are injected into descriptors. The previous implementation caused various descriptors to never be normalized, which made it difficult to know what were the descriptors each function should expect.Similarly, the descriptors returned by
Resolve#getResolutionDependenciesare now expected to be the result ofConfiguration#normalizeDependencycalls.Note that this only applies to the
dependenciesfield; thepeerDependenciesfield is unchanged, as it must only contains semver ranges without any protocol (with an exception forworkspace:, but that's not relevant here).
The
Resolve#getResolutionDependenciesfunction must now return an object of arbitrary string keys and descriptor values (instead of a map withDescriptorHashkeys). Those descriptors will be resolved and assigned to the same keys as the initial object. This change allows resolvers to wrap resolution dependencies from other resolvers, which wasn't possible before since it'd have caused the key to change.The
generateLoaderfunction in@yarnpkg/pnpno longer generates the$$SETUP_STATEfunction, it now needs to be present in theloaderpassed to the function.The
getCustomDataKeyfunction inInstallerfrom@yarnpkg/corehas been moved toLinker.renderForm'soptionsargument is now required to enforce that custom streams are always specified.npmConfigUtils.getAuditRegistryno longer takes aManifestas its first argument.The
FetchOptions.skipIntegrityCheckoption has been removed. UseFetchOptions.cacheOptions.skipIntegrityCheckinstead.- Removed
MapConfigurationValuehas been removed. UsemiscUtils.ToMapValueinstead. Manifest.isManifestFieldCompatibleandManifest.prototype.isCompatibleWith{OS,CPU}have been removed. UseManifest.prototype.getConditionsandstructUtils.isPackageCompatibleinstead.versionUtils.{fetchBase,fetchRoot,fetchChangedFiles}have been moved from@yarnpkg/plugin-versionto@yarnpkg/plugin-git. UsegitUtils.{fetchBase,fetchRoot,fetchChangedFiles}instead.For consistency reasons:
Link{Resolver,Fetcher}have been renamed toPortal{Resolver,Fetcher}RawLink{Resolver,Fetcher}have been renamed toLink{Resolver,Fetcher}
FakeFSclasses are now required to implementlutimes{Sync,Promise}.- Removed
workspace.dependencieshas been removed. Useworkspace.anchoredPackage.dependenciesinstead. The
Installerclass must now returnBuildRequeststructures instead ofBuildDirective. This lets you mark that the build must be skipped, and the reason why.- Removed
startCacheReporthas been removed, and is now part of the output generated byfetchEverything. forgettableNames&forgettableBufferSizehave been removed (the only messages using them have been removed, making the forgettable logs implementation obsolete).- Removed
workspace.locatorhas been removed. You can instead use:workspace.anchoredLocatorto get the locator that's used throughout the dependency tree.workspace.manifest.versionto get the workspace version.
- Removed
configuration.{packageExtensions,refreshPackageExtensions}have been removed. Useconfiguration.getPackageExtensionsinstead. configuration.normalizePackagenow requires apackageExtensionsoption.- Removed
ProjectLookuphas been removed. BothConfiguration.findandConfiguration.findProjectCwdnow always do a lockfile lookup.
Installs
Yarn now caches npm version metadata, leading to faster resolution steps and decreased network data usage.
The
pnpmlinker avoids creating symlinks that lead to loops on the file system, by moving them higher up in the directory structure.The
pnpmlinker no longer reports duplicate "incompatible virtual" warnings.
Features
enableOfflineModeis a new setting that, when set, will instruct Yarn to only use the metadata and archives already stored on the local machine rather than download them from the registry. This can be useful when performing local development under network-constrained environments (trains, planes, ...).yarn run binnow injects the environment variables defined in.env.yarnwhen spawning a process. This can be configured using theinjectEnvironmentFilesvariable.yarn workspaces foreachnow automatically enables theyarn workspaces foreach ! --verboseflag in interactive terminals.Constraints can now be written in JavaScript. See the revamped documentation for more information.
Bugfixes
yarn dlxwill no longer report false-positiveUNUSED_PACKAGE_EXTENSIONwarningsyarn workspacewill now set$INIT_CWDto the CLI working directory rather than the workspace root.
Shell
The builtin shell now supports whitespace-only commands.
Compatibility
The patched filesystem now supports
FileHandle.readLines.PnP now reports missing files when in watch mode.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.