1
头图

What is pnpm?

The full name is performant npm (high-performance npm), as the name implies, it is a npm . As for why it is high-performance, and in what way is it used to solve the problem of relying on the package size to approach a black hole, what is yarn Improvement, there are already official website documents 161aaeedb9c088 interpretation of countless big guys 161aaeedb9c089, I will not talk about it again, in short, it is Do you think we have any reason not to use it?

Why is it said that now is the right time

Because nodejs of v16.13.0 version and v16.13.1 version is already LTS (long-term maintenance releases), why mention the two versions, because since 16.13 later version of the built-in tools experimental corepack , corepack is what?

Look at the document !
If you don’t want to see it, let me give you a brief introduction: it is a nodejs built-in management pack manager

u=3729687073,1190663887&fm=253&fmt=auto&app=120&f=JPEG.webp

Don't worry, I will explain it to you in a simple way. You can see what we usually use to install dependencies during development.

1. npm

2. yarn

3. pnpm

4. ...

Is it messy? Except nodejs which comes with default npm , do you have to install it globally?

This corepack is a tool that comes by default since the nodejs v16.13 version, which is specially used to manage the tools that these installations depend on. The also comes with pnpm good guy!

How to use it?

First of all, if you have not installed nvm please install a nvm to keep the previous node . Don’t ask me what nvm is

nvm

document linux and osx users

document for win users

nvm upgrade

If you are a windows user and you have installed nvm-windows before, and want to use corepack manage pnpm , you also need to upgrade nvm-windows 1.1.8 version, because this version can only support corepack

If you are not windows , just look at the Install & Update Script part in the nvm document to upgrade or install it, source click on your bash/zsh configuration file.

Those who know how to upgrade, and those who have stepped on this pit can skip it

Download and install the upgrade package

First find the 1.1.8 releases page warehouse, and then find nvm-update.zip , download and unzip the file and run the nvm-update.exe .

Step on the pit

Before this, if you use nvm install 16.13 and above version nodejs , please uninstall first, then right-click on your start menu to find Windows PowerShell (administrator) click, and then go through

nvm install 16.13.1

Install the latest LTS . As of the LTS of 16.13.1 , the latest version 061aaeedb9c30e is 061aaeedb9c30f. It depends on the situation. After the installation is complete:

nvm use 16.13.1

Switch to the specified version, and then follow the documentation on the pnpm official website to open the corepack

corepack enable

Usually corepack is not the latest, so we have to upgrade to the latest pnpm version number, you can go to npmjs official website to see. As of the post, the latest version is 6.23.6

corepack prepare pnpm@6.23.6 --activate

You're done

At this point you can pnpm install/dev/build , gym, take off, take off~

1638589973(1).jpg

If there are other problems in the installation process, please leave a message to discuss!


Senar
35 声望8 粉丝