I. Concepts
performant npm, means "high performance npm". pnpm by npm/yarn derived from the npm/yarn potential internal bugs, greatly optimized performance, expanding the use of scenarios . It is known as "the most advanced package management tool".
II. Characteristics
Fast speeds, disk space savings, support forSingle code base - monorepoHigh security
Compared to yarn/npm, the two popular package management tools, pnpm also has a great performance improvement, according to the current official benchmark data can be seen in some comprehensive scenarios than npm/yarn is about twice as fast.
III. Storage management
Addressing by content, using symlinks
IV. Dependency management
npm1, npm2 using recursive management, npm3, npm3 +, yarn dependency flattening management to eliminate dependency lifting.
pnpm dependency strategy: eliminating dependency lifting, normalizing topology
V. Security
When using npm/yarn, due to the flat structure of node_module, if A depends on B and B depends on C, then A can use C directly, but the problem is that A does not declare C as a dependency. Therefore, this kind of illegal access occurs. However, pnpm has created a dependency management method that solves this problem and ensures security.
VI. Installation
npm i pnpm -g
VII. Viewing version information
VIII. Upgraded versions
pnpm add -g pnpm to update
IX. Setting up the source
pnpm config get registry //view source
pnpm config set registry //switch taobao source
X. Installation of project dependencies
pnpm install
XI. Operational projects
pnpm run dev
XII. pnpm-workspace implements a single codebase
Architecture-single-code-base-monorepo-pnpm-workspace: basic use_snow@li's blog - CSDN Blogs
xiii. relevant records
13.1. Problems with similar packages that cannot be parsed
Solution:
Create the .npmrc file in the root directory
shamefully-hoist = true
Delete node_modules and run pnpm install again to solve the problem.
Some packages are only valid when node_modules is in the root directory, you can use this configuration to promote those packages that are not in the root directory of node_modules.
Or execute:
pnpm i --shamefully-hoist
Both methods were tested successfully.
13.2 Introduction to pnpm add and pnpm install
Introduction to the add and install commands of the pnpm series_pnpm add-CSDN Blog
XIV. Reference links
Fast, disk space efficient package manager | pnpm official website
Baidu Security Verification
pnpm Brief Introduction_A little cabbage~'s blog-CSDN Blog_pnpm
pnpm use tutorial_Shen said the blog-CSDN Blog_pnpm use
Vite+TS takes you on a journey to build a Vue3 component library of your own - Beep