PNPM is what?

Performant NPM (High performance NPM) is an alternative to NPM. As for why high performance and how to solve the problem of dependency package volume approaching the black hole, what is the improvement over this yarn? In short, it’s fast, nice, space-saving, time-saving and safe! Why do you think we shouldn’t?

Why is now the time ripe

Since nodeJS v16.13.1 and v16.13.2 are LTS(long term maintenance) versions, they are included in the experimental corepack tool. What is Corepack?

Look at the document! Nodejs is a built-in management package manager

Don’t worry, I will explain it to you in a colloquial way, you see what we usually use when installing dependencies in development

1. npm

2. yarn

3. pnpm

4….

Is it a mess? Do you need to install nodeJS globally in addition to the default NPM?

Corepack is a tool that comes with nodeJS v16.13 by default. It is designed to manage the installation dependencies of these tools, and most importantly, it comes with PNPM.

How do you use it?

First of all, if you don’t have NVM installed, please install an NVM to keep the previous Version of Node. Don’t ask me what NVM is

nvm

Documentation for Linux and OSX users

Win user documents

NVM upgrade

If you are a Windows user and you have previously installed NVM-Windows and want to use Corepack to manage PNPM, you will need to upgrade your NVM-Windows to version 1.1.8, which supports Corepack

If you’re not Windows, go directly to the Install & Update Script section of the NVM documentation to upgrade or Install, and source your bash/ ZSH configuration file

Know how to upgrade, step on this pit can jump

Download the installation or upgrade package

Go to the Releases page in the repository and then go to the nVM-update. zip file and run nVM-update. exe

Hit the pit

If you have installed nodeJS 16.13 or later using NVM, uninstall nodeJS first, right click on your Start menu, go to Windows PowerShell(Administrator) and click, then go through

NVM install 16.13.2Copy the code

Install the latest LTS version, up to the post, the latest LTS version is 16.13.2, everyone depends on the situation to install! After installation:

NVM use 16.13.2Copy the code

Switch to the specified version, and then follow the documentation on the PNPM website to start the experimental Corepack

corepack enable
Copy the code

Generally, the package manager version in Corepack is not the latest, so we need to upgrade to the latest. For the latest PNPM version number, you can go to the NPMJS website. As of the post, the latest version is 6.26.0

Corepack prepare [email protected] - activateCopy the code

In the source

pnpm config set registry https://registry.npmmirror.com
Copy the code

You’re done

PNPM install/dev/build

If you have any other problems during the installation process, please leave a comment and discuss!