当前位置:网站首页>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
运行脚本
边栏推荐
- 动态规划问题(六)
- Android studio连接MySQL并完成简单的登录注册功能
- Three years after graduation, write to you and me who may be confused [turn]
- laptop外接显示器
- [microservice] Nacos cluster building and loading file configuration
- Centos7 install mysql8
- 【TA-霜狼_may-《百人计划》】图形3.6 纹理压缩——包体瘦身术
- ZABBIX 5.0 uses its own redis template for monitoring
- CMake 基础学习
- Real time data warehouse: Netease strictly selects the practice of real-time data warehouse based on Flink
猜你喜欢

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

Classification and determination method of Worthington stemxyme

Newscenter, advanced area of attack and defense world web masters

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

Attack and defense world web master advanced area php2

Google browser, no installation required

Worthington - chemical properties and related studies of Worthington trypsin

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

Pycharm configuring the running environment

Event extraction and documentation (2008-2017)
随机推荐
2022 network security learning route is very detailed, recommended Learning
Do you know any formal part-time platforms?
SQL实现将多行记录合并成一行
Real time data warehouse: Didi's real-time data warehouse landing practice
动态规划问题(六)
Summary of wrong questions of software designers
[microservice] Nacos cluster building and loading file configuration
Visual full link log tracking
Real time data warehouse: meituan's implementation of real-time data warehouse construction based on Flink
Everything you have learned will come in handy at some point in your life (turn)
How can Plato obtain premium income through elephant swap in a bear market?
PIP image download
Detailed explanation of the usage of exists in MySQL
Detailed explanation of 9 common reasons for MySQL index failure
【C】 Reverse string (two recursive ideas)
递归/回溯刷题(下)
Principle of meter skipping
Intelligent trash can (VII) -- Introduction and use of sg90 steering gear (Pico implementation of raspberry pie)
SAP temporary tablespace error handling
Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R