Menu
User

DropVPS Team

Writer: Cooper Reagan

How to Install PNPM on CentOS 9

How to Install PNPM on CentOS 9

Publication Date

11/12/2025

Category

Articles

Reading Time

2 Min

Table of Contents

PNPM is a fast and efficient package manager for Node.js that saves disk space by using symlinks instead of duplicating dependencies.

Step 1: Update System Packages

Keep your system up to date to avoid compatibility issues:

sudo dnf update -y

Step 2: Install Node.js (If Not Installed)

PNPM requires Node.js. The default CentOS repositories may not include the latest version, so install it using the official NodeSource repo:

curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash -
sudo dnf install -y nodejs

Confirm installation:

node -v
npm -v

You should see version numbers for both.

Newer Node.js versions include Corepack, which simplifies installing and managing package managers like PNPM.

Enable Corepack:

sudo corepack enable

Then activate PNPM:

corepack prepare pnpm@latest --activate

Check the version:

pnpm -v

If you see a version number, PNPM is ready to use.

Step 4: Install PNPM Globally via NPM (Alternative Method)

If Corepack isn’t available or disabled, you can install PNPM manually with npm:

sudo npm install -g pnpm

Verify installation:

pnpm -v

Step 5: Create a Test Project

Make sure PNPM is working correctly by creating a new test project.

mkdir pnpm-test && cd pnpm-test
pnpm init

Install a simple package:

pnpm add lodash

Check the installed package list:

pnpm list

Optional Step: Enable Bash Auto-Completion

For command auto-completion in your shell:

pnpm completion bash | sudo tee /etc/bash_completion.d/pnpm > /dev/null
source /etc/bash_completion

PNPM is ideal for monorepo setups and large projects. To migrate an existing npm project, simply delete node_modules and package-lock.json, then run:

pnpm install

It’ll install dependencies faster and save significant disk space.

Linux VPS
U
Loading...

Related Posts