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
npm
can be link withnpm link
.In the package, type
npm link
and then go to the main project where the above link package is used and typenpm link package-name-from-package.json
examplenpm link @foo/basic
and that's it. -
The repository where is use
pnpm
with overrides.If you want to override the package version in the
pnpm
overrides, you need to type this into your package"overrides": "link:../foo-basic"
write path into package no path into dist and then runpnpm i
and that's it.
Note:
If you are using VS code, you are goint to need reload your IDE, sometimes - developer: Reload the window
.