To install Node.js on Arch Linux, use pacman for a system-managed JavaScript runtime or nvm for per-project version switching. Arch packages the rolling current branch as nodejs, ships npm separately as npm, and keeps LTS branches in packages such as nodejs-lts-krypton and nodejs-lts-jod.
The pacman path fits servers and single-version workstations because updates arrive with normal system upgrades. The nvm path fits projects that need Node 22, Node 24, or the latest upstream Current line without replacing the system node binary.
Update Arch Linux Before Installation
Synchronize package databases and upgrade installed packages before installing Node.js. Arch is a rolling release distribution, so a full upgrade first helps prevent dependency conflicts:
sudo pacman -Syu
Commands that need root privileges use
sudo. If your user is not in the sudoers file yet, run the commands as root or follow the guide on how to add and manage sudo users on Arch Linux.
Install Node.js on Arch Linux
Start by choosing which tool should own your runtime. Keep one default path in a shell profile; mixing a custom npm prefix, pacman Node.js, and nvm in the same shell can create confusing PATH behavior.
Choose a Node.js Version
Arch publishes the current Node.js package beside LTS-named packages. The LTS package names follow Node.js release codenames, so nodejs-lts-krypton is Node 24 and nodejs-lts-jod is Node 22.
| Package | Branch | Lifecycle | Use When |
|---|---|---|---|
nodejs | Arch current package | Short current-release window | You need the newest release packaged by Arch for current APIs or testing. |
nodejs-lts-krypton | 24.x | Active LTS, upstream support through April 2028 | Recommended default for most development and production work. |
nodejs-lts-jod | 22.x | Maintenance LTS, upstream support through April 2027 | Projects pinned to Node 22 or CI environments still standardized on that line. |
nodejs-lts-iron | 20.x | Upstream EOL since April 30, 2026 | Legacy projects only; avoid it for new applications. |
Check repository versions from your current mirror when an exact branch matters:
pacman -Si nodejs nodejs-lts-krypton nodejs-lts-jod nodejs-lts-iron npm | grep -E '^(Name|Version|Description)'
For most users, nodejs-lts-krypton is the safest default. Odd-numbered Current releases have a shorter support window, while Node 20 is now a legacy compatibility choice rather than a normal recommendation.
Install Node.js Current Package
Install Arch’s current-release Node.js package with npm:
sudo pacman -S nodejs npm
The nodejs package owns the node runtime. The separate npm package provides both npm and npx, so install both packages unless you intentionally want the runtime without JavaScript package-manager commands.
Install Recommended LTS Package
Install the active LTS branch for a stable default runtime:
sudo pacman -S nodejs-lts-krypton npm
Use nodejs-lts-jod instead when a project explicitly requires Node 22. Avoid nodejs-lts-iron for new projects because Node 20 is past upstream EOL even if the Arch package is still visible in repository metadata.
Verify Node.js and npm
Confirm the installed commands and their package owners:
node --version
npm --version
command -v npx
pacman -Qo "$(command -v node)" "$(command -v npm)" "$(command -v npx)"
Relevant output should show the selected Node.js branch, npm, and npx ownership:
v24.x.x 11.x.x /usr/bin/npx /usr/bin/node is owned by nodejs-lts-krypton 24.x.x-... /usr/bin/npm is owned by npm 11.x.x-... /usr/bin/npx is owned by npm 11.x.x-...
Pacman-managed Node.js updates arrive through regular Arch upgrades:
sudo pacman -Syu
Configure npm Global Packages for pacman Node.js
Use this workflow only when pacman owns your Node.js runtime. nvm already stores global packages per Node.js version under ~/.nvm/, and custom npm prefix settings can stop nvm from switching versions cleanly.
Set a User-Local npm Prefix
Configure npm to install global packages under ~/.local, then make sure ~/.local/bin is available in the current shell and future Bash sessions:
npm config set prefix "$HOME/.local"
mkdir -p "$HOME/.local/bin"
touch "$HOME/.bashrc"
grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' "$HOME/.bashrc" || echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc"
export PATH="$HOME/.local/bin:$PATH"
For Zsh, use ~/.zshrc instead of ~/.bashrc in the profile commands.
Verify the npm Prefix
Confirm npm now uses the user-owned prefix:
npm config get prefix
/home/username/.local
Test a Global npm Package
Install a small package, verify its command path, then remove it:
npm install -g http-server --no-audit --no-fund
command -v http-server
npm list -g --depth=0 http-server --unicode=false
npm uninstall -g http-server
The command path should resolve under ~/.local/bin/. If it does not, check that ~/.local/bin appears in echo $PATH.
Do not use
sudo npm install -gfor normal global packages on Arch Linux. Root-owned npm installs write outside pacman’s package tracking and can create file conflicts during upgrades.
Manage Multiple Node.js Versions with nvm on Arch Linux
nvm is a shell function that installs Node.js versions inside your home directory and changes PATH for the active shell. Use it when different projects need different Node.js major versions or when you need an upstream Current release before the Arch nodejs package catches up.
If you previously configured a custom npm prefix for the pacman workflow, remove that prefix before using nvm:
unset npm_config_prefix NPM_CONFIG_PREFIX PREFIX
npm config delete prefix
Also remove any older export npm_config_prefix=... line from your shell profile. Keep the pacman npm prefix only in shells where you do not use nvm.
Install nvm from Arch Repositories
Install nvm and curl. The Arch nvm package installs the shell scripts under /usr/share/nvm/, while curl gives nvm a downloader on minimal systems:
sudo pacman -S nvm curl
Add the Arch nvm initialization script to Bash and load it in the current shell:
touch "$HOME/.bashrc"
grep -qxF 'source /usr/share/nvm/init-nvm.sh' "$HOME/.bashrc" || echo 'source /usr/share/nvm/init-nvm.sh' >> "$HOME/.bashrc"
source /usr/share/nvm/init-nvm.sh
For Zsh, write the same source line to ~/.zshrc and run source ~/.zshrc.
Verify nvm loaded as a shell function:
command -v nvm
nvm --version
nvm 0.40.x
Install Node.js Versions with nvm
Install the latest active LTS release:
nvm install --lts
Install a specific major version when a project requires it:
nvm install 22
Install the latest upstream Current release when you need a newer major than Arch currently packages:
nvm install node
Switch Between nvm Versions
List installed versions, switch for the current shell, and set the default for new shells:
nvm ls
nvm use 24
nvm alias default 24
The switch output should show the selected Node.js and npm versions:
Now using node v24.x.x (npm v11.x.x)
Use Per-Project Node.js Versions
Projects can pin a runtime in a .nvmrc file at the repository root:
printf '22\n' > .nvmrc
nvm use
Found '/home/username/project/.nvmrc' with version <22> Now using node v22.x.x (npm v10.x.x)
nvm-managed Node.js versions are separate from pacman packages. They coexist because nvm installs under
~/.nvm/and changes PATH only for shells where the nvm function is loaded.
Use npx, Corepack, pnpm, and Yarn on Arch Linux
The npm package provides npx. If node works but npx is missing, install npm and refresh the shell command cache:
sudo pacman -S npm
hash -r
command -v npx
Arch packages Corepack, pnpm, and Yarn separately. Choose only the helper your project uses; each one is separate from the npm and npx commands.
Install Corepack
sudo pacman -S corepack
Install pnpm
sudo pacman -S pnpm
Install Yarn Classic
sudo pacman -S yarn
These are pacman-managed helpers. On a system with no Node.js package installed, they can also install a package that provides nodejs to satisfy dependencies. If you want all JavaScript tooling to stay under nvm, switch to the nvm-managed Node.js version first and follow that project’s package-manager setup there instead of installing Arch helper packages. The yarn package is Yarn classic; projects pinned through Corepack or a packageManager field should follow that project workflow after installing corepack.
Test Your Node.js Installation on Arch Linux
Run a quick runtime check before using Node.js for a real project.
Run a JavaScript Expression
Execute a JavaScript expression directly from the terminal:
node -e "console.log('Node.js ' + process.version + ' is working on Arch Linux')"
Node.js v24.x.x is working on Arch Linux
Create and Run an HTTP Test Server
Create a temporary JavaScript file without depending on a separate editor package:
cat > test.js <<'EOF'
const http = require('http');
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello from Node.js on Arch Linux\n');
});
server.listen(3000, () => {
console.log('Server running at http://localhost:3000/');
});
EOF
node test.js
Server running at http://localhost:3000/
Open another terminal and test the local server with the Linux curl command or a browser. If curl is missing, install it with sudo pacman -S curl.
curl http://localhost:3000
Hello from Node.js on Arch Linux
Press Ctrl+C in the first terminal, then remove the temporary file:
rm test.js
Initialize an npm Project
Create a disposable project directory and let npm generate a default package.json:
mkdir ~/test-project && cd ~/test-project
npm init -y
Relevant output includes the generated project file:
Wrote to /home/username/test-project/package.json:
{
"name": "test-project",
"version": "1.0.0",
...
}
Remove the disposable project after the check:
cd ~ && rm -rf ~/test-project
Install Native Addon Build Dependencies on Arch Linux
Some npm packages compile native C/C++ addons through node-gyp. The Arch npm package installs node-gyp, but native addons still need a compiler, Make, pkgconf, and Python:
sudo pacman -S --needed base-devel python
base-devel is an Arch metapackage for common build tools, including GCC and Make. For compiler-specific setup, see the guide to install GCC on Arch Linux. Packages such as bcrypt, sharp, sqlite3, and canvas may also require matching system libraries; SQLite projects can use the guide to install SQLite on Arch Linux.
Update Node.js on Arch Linux
For pacman-installed Node.js, update the runtime with the rest of the system:
sudo pacman -Syu
For nvm-managed Node.js, install the latest patch for the selected branch and reset the default alias when needed:
nvm install --lts
nvm alias default 'lts/*'
For a pinned major, update that major explicitly:
nvm install 24
nvm alias default 24
Troubleshoot Node.js on Arch Linux
npm Permission Errors on Global Install
Error: A global npm install fails with an EACCES path under /usr/lib/node_modules/.
npm error code EACCES npm error syscall mkdir npm error path /usr/lib/node_modules/package-name npm error errno -13
Cause: npm is trying to write to the system global prefix, which belongs to pacman-managed files.
Fix: Set a user-owned prefix for pacman-managed Node.js and reload PATH in the current shell:
npm config set prefix "$HOME/.local"
mkdir -p "$HOME/.local/bin"
export PATH="$HOME/.local/bin:$PATH"
Verify: Confirm the prefix no longer points at /usr or /usr/local:
npm config get prefix
nvm Reports an npm Prefix Conflict
Error: nvm reports that it is not compatible with an npm prefix or npm_config_prefix environment variable.
nvm is not compatible with the npm config "prefix" option
Cause: A prefix setting from the pacman npm workflow is still active in the shell or in ~/.npmrc.
Fix: Remove the custom prefix before loading nvm:
unset npm_config_prefix NPM_CONFIG_PREFIX PREFIX
npm config delete prefix
source /usr/share/nvm/init-nvm.sh
nvm use --lts
Verify: Check that nvm now owns the active node path:
command -v node
nvm current
npx Command Not Found
Error: node works, but npx returns command not found.
Cause: The runtime was installed without the separate Arch npm package.
Fix: Install npm, clear the shell command cache, and verify package ownership:
sudo pacman -S npm
hash -r
command -v npx
pacman -Qo "$(command -v npx)"
/usr/bin/npx is owned by npm 11.x.x-...
Wrong Node.js Version After nvm use
Error: node --version still shows the pacman-installed version after nvm use.
Cause: The nvm shell function is not loaded, or the shell has cached the old node path.
Diagnostic: Check the active command path and all visible node matches:
command -v node
type -a node
Fix: Load nvm, clear the shell hash table, and switch again:
source /usr/share/nvm/init-nvm.sh
hash -r
nvm use 24
node-gyp Build Failures
Error: npm install fails with missing Python, Make, compiler, or node-gyp messages.
gyp ERR! find Python gyp ERR! configure error gyp ERR! stack Error: Could not find any Python installation to use
Fix: Install the Arch build-tool metapackage and Python:
sudo pacman -S --needed base-devel python
Verify: Check the main build tools before retrying the project install:
command -v gcc make python
npm install
Global Package Command Not Found
Error: A globally installed npm package appears installed, but its command is not found.
Diagnostic: Check the global package list, npm prefix, and PATH:
npm list -g --depth=0 --unicode=false
npm config get prefix
echo "$PATH"
Fix: Add the prefix’s bin directory to PATH. If npm config get prefix returns /home/username/.local, then /home/username/.local/bin must appear in PATH.
Remove Node.js from Arch Linux
Remove the package-managed runtime first, then delete user-level npm or nvm data only when you no longer need those global packages or installed Node.js versions.
Remove pacman-Installed Node.js
If npm is still installed and you configured a custom npm prefix, reset the npm prefix before removing npm:
npm config delete prefix
Remove the current-release package and npm:
sudo pacman -Rns nodejs npm
For the recommended LTS package, remove the matching LTS package instead:
sudo pacman -Rns nodejs-lts-krypton npm
The -Rns flags remove the selected packages, unused dependencies, and pacman backup files. If another installed package depends on Node.js or npm, keep the dependency installed or remove the dependent package first instead of forcing removal.
Check which optional JavaScript package-manager helpers are installed, then remove only the package names you no longer need:
pacman -Qq corepack pnpm yarn 2>/dev/null
Remove Corepack when no project still uses it:
sudo pacman -Rns corepack
Remove pnpm when no project still uses it:
sudo pacman -Rns pnpm
Remove Yarn classic when no project still uses it:
sudo pacman -Rns yarn
Remove nvm and nvm Data
Unload nvm from the current shell when it is active, remove the pacman package, then delete nvm-managed Node.js versions:
nvm deactivate 2>/dev/null || true
nvm unload 2>/dev/null || true
sudo pacman -Rns nvm
rm -rf "$HOME/.nvm"
Remove Global npm Packages and Cache
The cleanup commands delete user-level global npm packages, npm-created command symlinks, and the npm cache. Back up anything you need before running them.
rm -rf "$HOME/.local/lib/node_modules"
find "$HOME/.local/bin" -lname '*/node_modules/*' -delete 2>/dev/null
rm -rf "$HOME/.npm"
Clean Up Shell Configuration
Remove the lines added for Node.js tooling from ~/.bashrc or ~/.zshrc:
export PATH="$HOME/.local/bin:$PATH", if you no longer use that user-local bin directorysource /usr/share/nvm/init-nvm.sh- Any older
export npm_config_prefix=...line from previous npm prefix setups
Open a new terminal after editing the shell profile, or reload the file you changed.
Verify Node.js Removal
Confirm the package state and clear any cached command paths:
pacman -Q nodejs nodejs-lts-krypton nodejs-lts-jod nodejs-lts-iron npm nvm corepack pnpm yarn 2>/dev/null
hash -r
command -v node
command -v npm
command -v npx
command -v nvm
A fully removed setup should print no package names and no command paths. If another Node.js method remains installed, node or npm may still resolve through that method.
Node.js Resources and Related Arch Linux Guides
The Arch Wiki Node.js page is the best Arch-specific reference for package-management notes and local JavaScript runtime behavior.
For common development companions, install Git on Arch Linux for source control, install GCC on Arch Linux for native addon builds, and install Docker on Arch Linux for containerized Node.js applications. Database-backed projects can use the guides to install PostgreSQL on Arch Linux, install MariaDB on Arch Linux, or install SQLite on Arch Linux.
Official upstream and package references:
- Node.js documentation: Official API reference for the current release line.
- Node.js previous releases: Official lifecycle, codename, and support-status table.
- Node.js end-of-life releases: Official EOL status and security-risk reference.
- npm documentation: npm configuration, package management, and registry usage.
- nvm GitHub repository: nvm commands, shell integration, and troubleshooting.
- Arch nodejs package, nodejs-lts-krypton, nodejs-lts-jod, nodejs-lts-iron, npm, nvm, corepack, pnpm, and yarn: Current Arch package metadata.
Conclusion
Node.js is ready on Arch Linux through either pacman-managed packages or nvm-managed project versions. Use nodejs-lts-krypton with npm for the stable system path, keep npm globals in a user-owned prefix only for pacman Node.js, and switch to nvm when project-specific major versions matter. For production deployments, use the guide to install UFW on Arch Linux or install firewalld on Arch Linux before exposing application ports.


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>