A Yarn lockfile is a contract: the project expects a specific package-manager behavior, not just any npm-compatible tool. To install Yarn on Fedora, choose Fedora’s Yarn Classic package, Corepack for Modern Yarn, NVM with npm, or the upstream Classic RPM repository.
Current Fedora releases package Yarn Classic as yarnpkg. The official Yarn workflow now centers on Corepack for project-pinned Yarn 4.x releases, so use DNF for existing Classic projects and Corepack for Modern Yarn.
Install Yarn on Fedora
The first two methods cover most Fedora systems. DNF gives you a system-managed Yarn Classic command, while Corepack gives each project its own Yarn version through package.json.
Choose a Yarn Installation Method on Fedora
Use the package source that matches the project you need to run, not just the newest version number. Yarn Classic and Modern Yarn can both be correct depending on the repository.
| Method | Source | Yarn Line | Update Behavior | Best Fit |
|---|---|---|---|---|
| Fedora DNF | Fedora yarnpkg package | Yarn Classic 1.22.x | Updated through dnf upgrade | Existing projects that expect Yarn Classic or a simple system package |
| Corepack | Official Yarn workflow | Modern Yarn 4.x or a project-pinned release | Updated per project with yarn set version stable | New projects, monorepos, and teams that pin the package manager in version control |
| NVM and npm | NVM plus npm registry package | Yarn Classic 1.22.x | Updated per active NVM Node.js version with npm | Developers who already switch Node.js versions with NVM |
| Yarn Classic RPM repository | Upstream Yarn RPM repository | Yarn Classic 1.22.x | Updated through DNF after adding the repository | Systems that specifically need the upstream yarn RPM package name |
Yarn Classic 1.x remains widely used for older projects, but active Yarn docs point new workflows toward Corepack and Modern Yarn.
Pick one method unless you deliberately need more than one. Fedora, Corepack, NVM, and the upstream RPM repository can all expose a
yarncommand, and your shell runs whichever path wins onPATH. Verify the active command withcommand -v yarnbefore troubleshooting version mismatches.Do not replace a repository’s expected Yarn line until you check that project’s lockfile and package-manager requirements.
Update Fedora Before Installing Yarn
Refresh Fedora package metadata and apply available updates before installing development tools:
sudo dnf upgrade --refresh
This keeps DNF’s package decisions current, especially for Node.js dependency packages that can move between Fedora releases.
Install Yarn Classic with Fedora DNF
Fedora packages Yarn Classic as yarnpkg. The package installs both yarn and yarnpkg commands and pulls a compatible Node.js runtime automatically.
sudo dnf install yarnpkg
Verify the Yarn command after DNF finishes:
yarn --version
A Fedora-packaged Classic install currently returns:
1.22.22
Check the command owner when you need to confirm that the Fedora package, not another Node.js toolchain, provides yarn:
rpm -qf /usr/bin/yarn
Relevant output includes:
yarnpkg-1.22.22-18.fc44.x86_64
Install Modern Yarn with Corepack
Use Corepack when a project expects Modern Yarn or stores the package-manager version in package.json. Fedora’s Node.js RPMs do not currently provide a corepack command, so install Node.js and npm first, then install Corepack from npm.
If you still need to choose a runtime source, the Node.js installation guide for Fedora compares Fedora packages, NodeSource, and NVM before you add Yarn.
sudo dnf install nodejs npm
sudo npm install -g corepack@latest
sudo corepack enable
Create a project directory and initialize Modern Yarn:
mkdir ~/yarn-modern-demo
cd ~/yarn-modern-demo
yarn init -2 -y
yarn --version
Modern Yarn uses a moving stable line, so the exact patch version changes. A current install prints a 4.x version:
4.x.x
Confirm the project now records Yarn as its package manager:
grep '"packageManager"' package.json
Relevant output looks like this:
"packageManager": "yarn@4.x.x"
Install Yarn Classic with NVM and npm
Use the NVM method when each project needs a different Node.js release. If NVM is already installed and loaded in your shell, skip directly to the Node.js and Yarn commands.
Install curl for the installer download, then run the current NVM installer:
sudo dnf install curl
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
Load NVM into the current Bash session and verify that the shell function exists:
source ~/.bashrc
command -v nvm
The verification command should return:
nvm
Zsh users should source ~/.zshrc instead. After NVM is active, install the latest Node.js LTS line and add Yarn Classic through npm:
nvm install --lts
npm install -g yarn
yarn --version
The npm package provides Yarn Classic:
1.22.22
Install Yarn Classic from the Upstream RPM Repository
The upstream Yarn RPM repository is optional on Fedora because Fedora already packages Yarn Classic. Use this method only when you specifically need the upstream yarn RPM package name or need to match an existing system policy that uses the Yarn repository.
Import the Yarn RPM signing key and confirm that RPM registered the expected Yarn key fingerprint:
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}\n' | grep -i '6963f07f'
Relevant output includes the Yarn RPM signing-key fingerprint:
gpg-pubkey-9a6f73f34beb74734d8c69149cbbb5586963f07f
Add the repository file, then install Yarn:
curl -fsSL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo > /dev/null
sudo dnf install yarn
Verify the package, command, installed source, and repository state:
rpm -q yarn
yarn --version
dnf info --installed yarn | grep -E '^(Name|Version|Release|From repository)'
dnf repolist --enabled | grep -E '^yarn[[:space:]]'
Relevant output includes:
yarn-1.22.22-1.noarch 1.22.22 Name : yarn Version : 1.22.22 Release : 1 From repository : yarn yarn Yarn Repository
Configure Yarn on Fedora
Most projects work without global Yarn configuration. Use these settings only when you need a user-owned global binary path or a custom cache location for Yarn Classic.
Set a User-Owned Yarn Global Prefix
For Yarn Classic global packages, use a prefix inside your home directory instead of writing global package executables into a root-owned location:
yarn config set prefix "$HOME/.yarn-global"
mkdir -p "$HOME/.yarn-global/bin"
printf '\nexport PATH="$HOME/.yarn-global/bin:$PATH"\n' >> ~/.bashrc
source ~/.bashrc
Check that the configured binary directory appears in your shell path:
printf '%s\n' "$PATH" | tr ':' '\n' | grep -F "$HOME/.yarn-global/bin"
Set or Inspect the Yarn Cache
Yarn Classic stores downloaded packages in a cache so repeated installs do not fetch the same archives again. Set a custom cache folder only when your home directory layout or disk policy requires it:
yarn config set cache-folder "$HOME/.cache/yarn"
yarn config list
For Modern Yarn projects, keep configuration inside the project and inspect it from the project directory:
yarn config
Manage Packages with Yarn
The daily commands are similar across Yarn Classic and Modern Yarn, but update commands differ. Run these from the root of the project that contains package.json.
Create a Yarn Project
For a Yarn Classic project, initialize package.json with default values:
mkdir ~/classic-yarn-app
cd ~/classic-yarn-app
yarn init -y
For a Modern Yarn project, initialize with the Corepack-aware Yarn 2+ layout:
mkdir ~/modern-yarn-app
cd ~/modern-yarn-app
yarn init -2 -y
Add and Remove Dependencies
Add runtime dependencies with yarn add, and use -D for development-only tools such as test runners:
yarn add lodash
yarn add -D jest
Remove a dependency from both package.json and the lockfile:
yarn remove lodash
Install Dependencies from a Lockfile
When you clone an existing repository, install the dependencies recorded in package.json and yarn.lock:
yarn install
Yarn reads the lockfile to keep dependency versions consistent across machines.
Update Project Dependencies
Yarn Classic uses yarn upgrade for dependency updates:
yarn upgrade lodash
yarn upgrade
Modern Yarn uses yarn up for the same job:
yarn up lodash
yarn up
If a command fails with an unknown command error, check the project’s pinned Yarn version with yarn --version and use the command family that matches that major release.
Run Package Scripts
Yarn runs scripts from the scripts section of package.json. A minimal script block looks like this:
{
"scripts": {
"start": "node index.js",
"test": "jest",
"build": "webpack --mode production"
}
}
Run a script by name:
yarn run start
Common script names can also run without run:
yarn start
yarn test
yarn build
Update Yarn on Fedora
Use the update command that matches the installation method. Mixing update paths can leave one Yarn command shadowing another on your PATH.
Update DNF-Managed Yarn
If you installed Fedora’s yarnpkg package, update it through DNF:
sudo dnf upgrade yarnpkg
yarn --version
If you installed the upstream repository package named yarn, update that package name instead:
sudo dnf upgrade yarn
yarn --version
Update Modern Yarn with Corepack
Run Modern Yarn updates inside the project so the repository records the package-manager version change:
yarn set version stable
yarn install
yarn --version
Update the Corepack utility itself only when you installed it globally through npm:
sudo npm update -g corepack
Update npm-Installed Yarn
If Yarn came from npm under NVM or another user-managed Node.js install, update it with npm from that same active Node.js version:
npm update -g yarn
yarn --version
Troubleshoot Yarn on Fedora
Most Yarn problems on Fedora come from using a command that belongs to a different install method, missing Corepack, or running a project-specific script outside the project checkout.
Yarn Command Is Missing After Installation
If the shell cannot find yarn, first check whether a Yarn RPM is installed:
rpm -q yarnpkg yarn
A missing Fedora package looks like this:
package yarnpkg is not installed package yarn is not installed
Install Fedora’s package when no Yarn RPM is present:
sudo dnf install yarnpkg
If the package is installed but the current shell still misses the command, clear Bash’s command cache and check again:
hash -r
command -v yarn
Corepack Command Is Missing
Fedora’s Node.js packages can install node and npm without installing a corepack command. Confirm the missing command first:
command -v corepack || echo "corepack is not installed"
Expected output when Corepack is absent:
corepack is not installed
Install and enable Corepack with npm:
sudo npm install -g corepack@latest
sudo corepack enable
Permission Denied During Global Yarn Installs
Global package commands can fail when the active Yarn or npm prefix points at a root-owned directory:
error An unexpected error occurred: "EACCES: permission denied, mkdir '/usr/local/share/.config'".
Check the active Yarn global directory:
yarn global dir
For Yarn Classic, move global package executables into a user-owned prefix:
yarn config set prefix "$HOME/.yarn-global"
mkdir -p "$HOME/.yarn-global/bin"
printf '\nexport PATH="$HOME/.yarn-global/bin:$PATH"\n' >> ~/.bashrc
source ~/.bashrc
Network Timeouts or Corrupted Cache
Slow network links, proxies, and stale cache entries can interrupt dependency installs:
error An unexpected error occurred: "https://registry.yarnpkg.com/package: ETIMEDOUT".
Increase the timeout, clear the cache, then retry the install:
yarn config set network-timeout 300000
yarn cache clean
yarn install
The timeout value uses milliseconds, so 300000 gives Yarn five minutes before it abandons a slow registry request.
Project-Specific Yarn Start Errors
If you reached this page because a project such as Signal Desktop documents yarn start, install Yarn first, then run the project command from that source checkout.
Application-specific build failures belong to that project’s build instructions, not to the Fedora Yarn package itself.
pwd
yarn --version
yarn start
Remove Yarn from Fedora
Remove the package or tool that installed Yarn. Keep Node.js, NVM, and project directories when other projects still depend on them.
Remove Fedora DNF Yarn
Remove Fedora’s yarnpkg package when you installed the default DNF method:
sudo dnf remove yarnpkg
rpm -q yarnpkg || true
hash -r
command -v yarn || echo "yarn command removed"
Expected verification after removal:
package yarnpkg is not installed yarn command removed
Remove Upstream Yarn Repository Packages
If you added the upstream Yarn RPM repository, remove the yarn package and repository file:
sudo dnf remove yarn
sudo rm -f /etc/yum.repos.d/yarn.repo
dnf repolist --enabled | grep -E '^yarn[[:space:]]' || echo "Yarn repository is not enabled"
If no other package source on the system uses the Yarn RPM signing key, remove that trust entry as well:
if rpm -q gpg-pubkey --qf '%{VERSION}-%{RELEASE}\n' | grep -qi '6963f07f'; then
sudo rpmkeys --delete 9A6F73F34BEB74734D8C69149CBBB5586963F07F
else
echo "Yarn RPM signing key is not installed"
fi
rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}\n' | grep -i '6963f07f' || echo "Yarn RPM signing key is not installed"
Remove Corepack or npm-Installed Yarn
For the Corepack method, disable the shims before removing the npm-installed Corepack package:
sudo corepack disable
sudo npm uninstall -g corepack
For the NVM/npm method, remove the globally installed Yarn package from the active Node.js version:
npm uninstall -g yarn
yarn --version
A removed npm-installed Yarn command usually returns:
bash: yarn: command not found
Remove Yarn User Data
The following cleanup removes home-directory Yarn cache, global-package, and configuration paths for your Linux account.
Do not run it inside a project directory, and do not delete project-level
.yarn/or.yarnrc.ymlfiles unless you intend to change that repository.
List home-level Yarn paths first:
for path in "$HOME/.cache/yarn" "$HOME/.yarn" "$HOME/.yarnrc" "$HOME/.yarnrc.yml" "$HOME/.yarn-global"; do
if [ -e "$path" ]; then
printf '%s\n' "$path"
fi
done
Remove only the user-level paths you no longer need:
rm -rf ~/.cache/yarn
rm -rf ~/.yarn
rm -rf ~/.yarnrc
rm -rf ~/.yarnrc.yml
rm -rf ~/.yarn-global
Conclusion
Yarn is ready on Fedora through DNF, Corepack, or NVM with npm. Keep the runtime aligned with install Node.js on Fedora, then add an editor with install Visual Studio Code on Fedora for a full JavaScript workspace.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>