当前位置:网站首页>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
运行脚本
边栏推荐
- Virtual lab basic experiment tutorial -8. Fourier transform (1)
- CV semantic segmentation model sketch (2)
- 2022 network security learning route is very detailed, recommended Learning
- CV target detection model sketch (2)
- [TA frost wolf _may- "hundred people plan"] art 2.2 model basis
- ACM SIGIR 2022 | interpretation of selected papers of meituan technical team
- Leetcode61. rotating linked list
- [TA frost wolf \u may - "hundred people plan"] Figure 3.6 texture compression - inclusion slimming
- Interpretation of ISO 13400 (doip) standard
- 【C】 Reverse string (two recursive ideas)
猜你喜欢

Detailed explanation of 9 common reasons for MySQL index failure
![[applet project development -- JD mall] uni app commodity classification page (first)](/img/6c/5b92fc1f18d58e0fdf6f1896188fcd.png)
[applet project development -- JD mall] uni app commodity classification page (first)

Event extraction and documentation (2008-2017)
![[CNN] Why is the convolution kernel size of CNN usually odd](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[CNN] Why is the convolution kernel size of CNN usually odd

动态规划问题(八)

CV target detection model sketch (2)

How NAT configures address translation

Why is it so difficult for the SEC to refuse the application for transferring gray-scale GBTC to spot ETF? What is the attraction of ETF transfer?

Have passed hcip and joined the company of your choice, and share the learning experience and experience of Huawei certification

Advanced area of attack and defense world web masters supersqli
随机推荐
Type 1-5 components
ACM SIGIR 2022 | interpretation of selected papers of meituan technical team
Where is sandbox's confidence in rejecting meta's acquisition of meta universe leader sand?
Do you know any formal part-time platforms?
Real time data warehouse: Netease strictly selects the practice of real-time data warehouse based on Flink
Compilation principle research study topic 2 -- recursive descent syntax analysis design principle and Implementation
【微服务】Nacos集群搭建以及加载文件配置
【C】 Replace spaces and realize binary parity bit exchange of integers by macros
Android studio连接MySQL并完成简单的登录注册功能
CV instance segmentation model sketch (1)
Sword finger offer 41. median in data flow
PIP image download
Worthington - chemical properties and related studies of Worthington trypsin
Interpretation of ISO 13400 (doip) standard
【MySQL系列】MySQL数据库基础
"Method not allowed", 405 problem analysis and solution
[applet project development -- JD mall] uni app commodity classification page (first)
centos7安装mysql8
【C】 Drink soda and find a single dog
Linux之yum安装MySQL