当前位置:网站首页>pnpm简述
pnpm简述
2022-07-25 09:25:00 【一只小白菜~】
什么是pnpm
pnpm是 Node.js 的替代包管理器。它是 npm 的直接替代品,但速度更快、效率更高。
为什么效率更高?当您安装软件包时,我们会将其保存在您机器上的全局存储中,然后我们会从中创建一个硬链接,而不是进行复制。对于模块的每个版本,磁盘上只保留一个副本。例如,当使用 npm 或 yarn 时,如果您有 100 个使用 lodash 的包,则磁盘上将有 100 个 lodash 副本。pnpm 可让您节省数 GB 的磁盘空间!
pnpm优势
pnpm 拥有 Yarn 超过 npm 的所有附加功能:
- 安全: 与 yarn 一样,pnpm 有一个包含所有已安装包校验和的特殊文件,用于在执行代码之前验证每个已安装包的完整性。
- 离线模式: pnpm 将所有下载的包 tarball 保存在本地注册表镜像中。当包在本地可用时,它从不发出请求。使用该
--offline参数可以完全禁止 HTTP 请求。 - 速度: pnpm 不仅比 npm 快,而且比 yarn 快。无论是冷缓存还是热缓存,它都比 yarn 快。yarn 从缓存中复制文件,而 pnpm 只是从全局存储中链接它们。
pnpm安装
npm install -g pnpm //通过 npm 安装
npx pnpm add -g pnpm //通过 npx 安装
设置源
pnpm config get registry //查看源
pnpm config set registry https://registry.npmmirror.com //切换淘宝源
添加包
pnpm add [package] //保存到依赖项
pnpm add -D [package] //保存到devDependencies
pnpm add -O [package] //保存到optionalDependencies
移除包
pnpm remove [package] //移除包
pnpm remove [package] --global //移除全局包
更新包
pnpm up //更新所有依赖项,遵守package.json中指定的范围
pnpm up --latest //最新更新所有依赖项,忽略package.json中指定的范围
设置存储路径
pnpm config set store-dir /path/to/.pnpm-store
想了解更多看pnpm官网: https://pnpm.js.org/installation/
边栏推荐
- 概率论与数理统计 4 Continuous Random Variables and Probability Distributions(连续随机变量与概率分布)(上篇)
- T5论文总结
- [Android studio] batch data import to Android local database
- Excel导入导出源码分析
- Es6详解
- NLM5系列无线振弦传感采集仪的工作模式及休眠模式下状态
- 阿里MQTT物联网平台“云产品流转”实战——两片ESP32通过物联网平台实现远程互操作
- ARMV8体系结构简介
- Visualization of sensor data based on raspberry pie 4B
- 工程监测多通道振弦传感器无线采集仪外接数字传感器过程
猜你喜欢

Introduction to low power consumption and UPF

File -- first acquaintance

Creation of adjacency matrix of undirected connected graph output breadth depth traversal

SystemVerilog syntax

Mlx90640 infrared thermal imager temperature measurement module development notes (V)

AMD EPYC 9664旗舰规格曝光:96核192线程 480MB缓存 3.8GHz频率

FPGA基础进阶

Linked list -- basic operation

¥ 1-2 example 2.2 put the union of two sets into the linear table

车辆属性最近一次入库时间初始化生成sql脚本文件
随机推荐
ESP32连接阿里云MQTT物联网平台
【Tensorflow2安装】Tensorflow2.3-CPU安装避坑指南!!!
概率论与数理统计 4 Continuous Random Variables and Probability Distributions(连续随机变量与概率分布)(上篇)
一个可以返回前一页并自动刷新页面的ASP代码.
Probability theory and mathematical statistics 3 discrete random variables and probability distributions (Part 2)
C函数不加括号的教训
Store to-do items locally (improve on to-do items)
Mixed supervision for surface defect detection: from weakly to fully supervised learning
ThreadLocal&Fork/Join
Arm preliminaries
Connection and data reading of hand-held vibrating wire vh501tc collector sensor
TensorFlow2 安装快速避坑汇总
Qt 6.2的下载和安装
testbench简介
无线中继采集仪的常见问题
入住阿里云MQTT物联网平台
Mlx90640 infrared thermal imager temperature measurement module development notes (V)
看一个双非二本(0实习)大三学生如何拿到阿里、腾讯的offer
ROS分布式操作--launch文件启动多个机器上的节点
T5论文总结