简体   繁体   English

npm、pnpm、yarn 或 pkglink 以节省时间和磁盘空间?

[英]npm, pnpm, yarn or pkglink for saving time and disk space?

I'm really frustrated by the size of node_modules folder that gets created every time for every project.我对每次为每个项目创建的 node_modules 文件夹的大小感到非常沮丧。 So, I've been looking for some time-space saving solutions.所以,我一直在寻找一些节省时间和空间的解决方案。 And I found PNPM ( https://pnpm.js.org/ ), Yarn ( https://yarnpkg.com/ ) and Pkglink ( https://github.com/jeffbski/pkglink ). And I found PNPM ( https://pnpm.js.org/ ), Yarn ( https://yarnpkg.com/ ) and Pkglink ( https://github.com/jeffbski/pkglink ). But I'm not sure which is better to serve my purpose.但我不确定哪个更适合我的目的。

Things I'm looking forward to solving:我期待解决的问题:

  1. I don't want to re-download the same packages over and over again我不想一遍又一遍地重新下载相同的包
  2. I don't want the same packages to be in multiple projects and eat up space我不希望相同的包出现在多个项目中并占用空间
  3. I want a stable, fast and disk space saving solution我想要一个稳定、快速且节省磁盘空间的解决方案

Looking for experts advice.寻求专家建议。

I think pnpm is satisfying all your requirements.我认为 pnpm 可以满足您的所有要求。

pnpm will only save a package once on a disk, and it will use hard links to add the package to different projects on the disk. pnpm 只会在磁盘上保存一次 package,它会使用硬链接将 package 添加到磁盘上的不同项目中。

You could achieve the same with Yarn+pkglink or npm+pkglink but that would be a two-step process.您可以使用 Yarn+pkglink 或 npm+pkglink 实现相同的效果,但这将是一个两步过程。 First, you'd run npm|yarn install then pkglink to remove the duplicates.首先,您将运行 npm|yarn install 然后 pkglink 删除重复项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM