“This is the second day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”

What is the PNPM

Modern package management tool PNPM (Performant NPM), which stands for Performant NPM

Go to the official website and you can see Benchmarks listing the data

This benchmark compares the performance of npm, pnpm, and Yarn (both regular and PnP variant). This benchmark compares the performance of NPM, PNPM and Yarn (regular and PnP variants).

action cache lockfile node_modules npm pnpm Yarn Yarn PnP
install 45.5 s 15.6 s 20.7 s 26.8 s
install 2.1 s 1.2 s 2.5 s n/a
install 12.2 s 3.8 s 7.4 s 1.7 s
install 17.9 s 8.4 s 13.7 s 6.7 s
install 30.3 s 12.6 s 13.4 s 19.4 s
install 2.9 s 1.7 s 7.9 s n/a
install 2.2 s 1.2 s 8.7 s n/a
install 2.8 s 5.9 s 14.4 s n/a
update n/a n/a n/a 2.1 s 11.7 s 17s 33.4 s

About twice as fast as NPM/YARN

How do I know about PNPM

If you want to see a variety of popular vue3 component library, when you see the general component library, you can directly yarn and then yarn Dev, but when you start the element- Plus, you will meet various pothoods

First of all, when it is Yarn, I am directly prompted to require a node version greater than 16

Use n if the next node is larger than 16

Then continue yarn, the result let me choose the version, I think it should be ok to choose a random version

What’s the result? Every version doesn’t work

Then I went to the Github development documentation for Element-Plus and saw that it needed PNPM to boot up. At this point, you have to install NNPM

Install the PNPM

Node not installed

You can install PNPM without installing Node

Node.js is not preinstalled

On POSIX systems, even if you don’t have Node.js installed, you can install PNPM using the following script:

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

If you don’t have curl installed and you want to use wget:

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

You can install Node.js using the PNPM env command.

Node. Js pre-installed

On Linux or macOS:

Curl -f https://get.pnpm.io/v6.16.js | node - add - global PNPMCopy the code

On Windows (PowerShell) :

(Invoke - WebRequest 'https://get.pnpm.io/v6.16.js' - UseBasicParsing). The Content | node - add - global PNPMCopy the code

Install the node

Of course, I chose to install using NPM

The use of NPM
npm install -g pnpm
Copy the code
By NPX resolution
npx pnpm add -g pnpm
Copy the code

Upgrade PNPM

Once PNPM is installed, there is no need to use other package managers to update it. You can upgrade PNPM using your own, as follows:

pnpm add -g pnpm
Copy the code

Uninstall the PNPM

If you use a standalone script to install PNPM (or NPX), then you should be able to uninstall the PNPM CLI using the following command:

pnpm rm -g pnpm
Copy the code

If you install PNPM using NPM, then you should uninstall PNPM using NPM:

npm rm -g pnpm
Copy the code

If you use PNPM to install some packages, then you need to list all global packages, run PNPM ls -g. There are two ways to remove global packages:

  1. runpnpm rm -g <pkg>...For each global package listed.
  2. runpnpm root -gFind the location of the global directory and delete it manually.

conclusion

Of course, I only have a basic understanding of PNPM, and I still need more time to understand it in the future.