Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate a project from npm to pnpm

Tags:

node.js

npm

pnpm

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?

like image 219
Aubin Avatar asked Jan 17 '19 15:01

Aubin


People also ask

Is pnpm compatible with NPM?

pnpm, fast and disk-efficient Version 1 of pnpm was released in 2017 by Zoltan Kochan. It is a drop-in replacement for npm, so if you have an npm project, you can use pnpm right away!

What does pnpm install do?

pnpm install is used to install all dependencies for a project. In a CI environment, installation fails if a lockfile is present but needs an update. Inside a workspace, pnpm install installs all dependencies in all the projects. If you want to disable this behavior, set the recursive-install setting to false .

Does pnpm work with Yarn?

And pnpm has its own lockfile format, so it's not directly compatible with Yarn or NPM.


1 Answers

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 [email protected].

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

like image 141
Aubin Avatar answered Nov 15 '22 08:11

Aubin