mikekubn.cz

How use npm link in pnpm overwrites

If you work on bigger project with more packages you will want to use pnpm, probably.

link

"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 with npm link.

    In the package, type npm link and then go to the main project where the above link package is used and type npm link package-name-from-package.json example npm 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 run pnpm 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.

Akcenta

Frontend Lead Developer
Akcenta

The beginning of the digitization of one of the biggest players in the financial market with currencies. Akcenta is Central Europe’s largest payment institution with more than 46,000, primarily B2B, clients.

Webscope.io

React senior developer
Webscope.io

Passionate about website development, app development, design, and the newest technologies we continuously deliver outstanding software solutions to our clients for over 5 years.

Arc

Arc Certified Remote Developer
Arc

Cooperation with foreign clients around the world on interesting projects

Livesport TV

React developer & QA tester
Livesport TV

Media services platform development for Livesport, that is the largest supplier of results from the world of sports in the world. You may know them from the Super Bowl. We developed SPA in React and other smaller landing websites.

Ping me.

LinkeIn
GitHub
Twitter