当前位置:网站首页>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
运行脚本
边栏推荐
- Leetcode59. Spiral matrix II
- JS four formulas for judging data types
- Sword finger offer 41. median in data flow
- Attack and defense world web master advanced area web_ php_ unserialize
- [microservice] Nacos cluster building and loading file configuration
- Servlet运行原理_API详解_请求响应构造进阶之路(Servlet_2)
- Web系统常见安全漏洞介绍及解决方案-CSRF攻击
- Install MySQL using Yum for Linux
- laptop外接显示器
- 【MySQL 8】Generated Invisible Primary Keys(GIPK)
猜你喜欢

CV instance segmentation model sketch (1)

MySQL installation and configuration tutorial (super detailed, nanny level)

Eye of depth (18) -- partial derivative

PHP poster QR code synthesis

IDEA2021.2安装与配置(持续更新)

Concurrency in go

熊市下PLATO如何通过Elephant Swap,获得溢价收益?

Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R

Leetcode63. Different paths II

Install MySQL using Yum for Linux
随机推荐
centos7安装mysql8
动态规划问题(四)
“Method Not Allowed“,405问题分析及解决
Oracle super full SQL, details crazy
Idea2021.2 installation and configuration (continuous update)
【MySQL系列】MySQL数据库基础
Cmake basic learning
curl (7) Failed connect to localhost8080; Connection refused
Plato farm is expected to further expand its ecosystem through elephant swap
Doip communication of canoe application case
Eye of depth (18) -- partial derivative
Solution: direct local.Aar file dependencies are not supported when building an aar
[microservice] Nacos cluster building and loading file configuration
Everything you have learned will come in handy at some point in your life (turn)
After SAP Oracle replicates a new instance, the remote connection of the database reports an error ora-01031
Application of Devops in Internet of things solutions
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
Servlet operation principle_ API details_ Advanced path of request response construction (servlet_2)
递归/回溯刷题(中)
Real time data warehouse: Didi's real-time data warehouse landing practice