当前位置:网站首页>pnpm的安装与使用
pnpm的安装与使用
2022-07-28 22:23:00 【web18484626332】
项目初衷
当使用 npm 或 Yarn 时,如果你有 100 个项目使用了某个依赖(dependency),就会有 100 份该依赖的副本保存在硬盘上。 而在使用 pnpm 时,依赖会被存储在内容可寻址的存储中,所以:
- 如果你用到了某依赖项的不同版本,只会将不同版本间有差异的文件添加到仓库。 例如,如果某个包有100个文件,而它的新版本只改变了其中1个文件。那么 pnpm update 时只会向存储中心额外添加1个新文件,而不会因为仅仅一个文件的改变复制整新版本包的内容。
- 所有文件都会存储在硬盘上的某一位置。 当软件包被被安装时,包里的文件会硬链接到这一位置,而不会占用额外的磁盘空间。 这允许你跨项目地共享同一版本的依赖。
因此,您在磁盘上节省了大量空间,这与项目和依赖项的数量成正比,并且安装速度要快得多!
安装
使用独立脚本
在 Windows 下(使用PowerShell):
iwr https://get.pnpm.io/install.ps1 -useb | iex
通过npm安装
npm install -g pnpm
更新
pnpm update -g pnpm
CLI命令
命令
含义
pnpm add
安装软件包到 dependencies
pnpm add -D
安装软件包到 devDependencies
pnpm add -g
全局安装软件包
pnpm install 或 pnpm i
下载项目所有依赖项
pnpm update 或 pnpm up
遵循 package.json 指定的范围更新所有的依赖项
pnpm update -g
从全局更新一个依赖包
pnpm remove
从项目的 package.json 中删除相关依赖项
pnpm remove -D
仅删除开发环境 devDependencies 中的依赖项
pnpm remove -g
从全局删除一个依赖包
pnpm run
运行脚本
边栏推荐
- Attack and defense world web master advanced area php2
- Have passed hcip and joined the company of your choice, and share the learning experience and experience of Huawei certification
- Idea error running 'application' command line is too long solution
- @Transactional 注解使用详解
- Advanced area of attack and defense world web masters warmup
- Network traffic monitoring tool iftop
- How can Plato obtain premium income through elephant swap in a bear market?
- What does WGet mean
- SAP temporary tablespace error handling
- 【C】 Replace spaces and realize binary parity bit exchange of integers by macros
猜你喜欢

【小程序项目开发 -- 京东商城】uni-app 商品分类页面(上)

【C】 Reverse string (two recursive ideas)

Android studio connects to MySQL and completes simple login and registration functions

Worthington - chemical properties and related studies of Worthington trypsin

With this, your messages can't be monitored

Attack and defense world web master advanced area PHP_ rce

Using recursion and chain header interpolation to realize the group turnover of linked lists -- leetcode25 K group turnover linked lists

Idea error running 'application' command line is too long solution

【微服务】Nacos集群搭建以及加载文件配置

Detailed principle explanation and verification results of digital clock based on FPGA
随机推荐
【C】 Replace spaces and realize binary parity bit exchange of integers by macros
【TA-霜狼_may-《百人计划》】图形3.6 纹理压缩——包体瘦身术
研发效能的道法术器
【TA-霜狼_may-《百人计划》】美术2.2 模型基础
SQL implementation merges multiple rows of records into one row
JS advanced ES6 ~ es13 new features
Newscenter, advanced area of attack and defense world web masters
12个MySQL慢查询的原因分析
动态规划问题(一)
Data warehouse: Doris' application practice in meituan
html+css+php+mysql实现注册+登录+修改密码(附完整代码)
Pycharm configuring the running environment
Virtual lab basic experiment tutorial -8. Fourier transform (1)
The difference between {} and ${}
Concurrency in go
PIP image download
Review of categories 1-4
Visual full link log tracking
基于 FPGA 实现数字时钟详细原理讲解及验证结果
【微服务】Nacos集群搭建以及加载文件配置