skip to content
shipanjodder.com

Install pnpm with npm on Windows/Linux

Updated:

Installing pnpm

On Windows

Using PowerShell:

Invoke-WebRequest https://get.pnpm.io/install.ps1 -UseBasicParsing | Invoke-Expression

On POSIX systems

curl -fsSL https://get.pnpm.io/install.sh | sh -

If you don’t have curl installed, you would like to use wget:

wget -qO- https://get.pnpm.io/install.sh | sh -

In a Docker container

# bash
wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.bashrc" SHELL="$(which bash)" bash -
# sh
wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh -
# dash
wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.dashrc" SHELL="$(which dash)" dash -

Using npm

npm install -g pnpm

or

npm install -g @pnpm/exe

Using Homebrew

brew install pnpm

Using winget

winget install -e --id pnpm.pnpm

To starts local dev server at localhost:3000

pnpm dev

Production build

Background run server

To run pnpm in the background using nohup (Linux/macOS):

nohup pnpm preview > output.log 2>&1 &

Stop server

Using lsof (If the Server Port is Known)

lsof -i :3000

3000 is the port that started the server

Once you get the PID:

kill <PID>



Updating pnpm

pnpm self-update

Uninstalling pnpm

Removing the pnpm CLI

If you used the standalone script to install pnpm, then you should be able to uninstall the pnpm CLI by removing the pnpm home directory: rm -rf $PNPM_HOME If you used npm to install pnpm, then you should use npm to uninstall pnpm: npm rm -g pnpm

Removing the global content-addressable store

rm -rf $(pnpm store path)

If you used pnpm in non-primary disks, then you must run the above command in every disk, where pnpm was used. pnpm creates one store per disk.