How use npm link in pnpm overwrites
If you work on bigger project with more packages you will want to use
pnpm, probably.
"pnpm": { "overrides": { "my-package-foo": "3.4.0", .... } },
What is pnpm?
Alternative of node package manager npm, but faster and more efficient.
When I started with pnpm, I tried to link local packages where my main project uses pnpm and other local packages use the standard npm. When I used the standard method of linking a project using npm link or pnpm link, I always got the error that the package does not exist.
I decided to write some steps below, how use the link when using pnpm overrides.
Steps:
-
The repository where is use
npmcan be link withnpm link.In the package, type
npm linkand then go to the main project where the above link package is used and typenpm link package-name-from-package.jsonexamplenpm link @foo/basicand that's it. -
The repository where is use
pnpmwith overrides.If you want to override the package version in the
pnpmoverrides, you need to type this into your package"overrides": "link:../foo-basic"write path into package no path into dist and then runpnpm iand that's it.
Note:
If you are using VS code, you are goint to need reload your IDE, sometimes - developer: Reload the window.






