11

We have built a project with a deep tree of dependencies with npm install and have a lot of issues under Microsoft Windows (secondary target).

I have read about pnpm and it seems to be a solution for us.

How to migrate our nested repository?

Build a new one from scratch, using pnpm?

Aubin
  • 14,617
  • 9
  • 61
  • 84
  • 2
    Do you mean you rely on a npm-shrinkwrap.json or package-lock.json because the project is fragile and would break with a different set of packages? you may create pnpm lockfile from npm lockfile by running "pnpm import" – Zoltan Kochan Jan 17 '19 at 19:17
  • 1
    if you have a monorepo with many packages, you need to configure a pnpm workspace. You basically need a pnpm-workspace.yaml file + some configs in a .npmrc in the root of the repo. You can read about it here: https://pnpm.js.org/docs/en/pnpm-recursive.html – Zoltan Kochan Jan 17 '19 at 19:18

2 Answers2

6

Finally, I have made a backup of node_modules and rebuilt it from scratch with pnpm and added concat to have only one JavaScript source and applied Google-compiler to it.

The only difficulty was about bootstrap because it have changed a lot in two years. We need to keep the old look of it, so the command I used is pnpm install bootstrap@3.3.7.

After completion, the look and feel was identical but node_modules has grew from 8 MB to 12 MB...

Aubin
  • 14,617
  • 9
  • 61
  • 84
  • 2
    So no improvement of pnpm over npm if file size grew? What is the size unity Mo? – Timo Mar 31 '22 at 20:52
  • 2
    Sorry, I'm French : mega octet is megabyte, MB (correction done in the text). – Aubin Apr 02 '22 at 08:20
  • It should be a good solution for multiple projects sharing dependencies. It seems that initial size is bigger but overall savings can improve over time. – Cat-Lord Apr 08 '22 at 15:46
  • You have to consider that there is a "bug" in the windows explorer and folder sizes might be wrong when hard links are used but pnpm makes use of hard links. So... See [this thread](https://stackoverflow.com/questions/28077454/windows-hard-links-disk-usage-inconsistency) – ortwic Jun 16 '23 at 17:18
1

You can pnpm import which takes your package-lock.json or yarn.lock and generates pnpm's lock file pnpm-lock.yaml. After that, you can pnpm install to install the dependencies of the project.

documentation

yamanidev
  • 374
  • 1
  • 3
  • 13