undefined…

less than 1 minute read

[May 24th, 2020 12:13 PM] tom.aerden: I’m setting up an nx workspace with (for now) two publisheable libraries, say A and B, A depends on B. I can npm link B to use it in another project, but when I try to npm link A there is an error no matching version found for B. This is because B is listed as a dependency of A in the package.json. Can I instruct nx to list B as a peerdependency instead, or am I taking the wrong approach ?

Responses:

you can go to dist/libs/package-a and do yarn link package-a, and vice versa

If that does not work, you best bet is probably to run a local NPM registry like verdaccio and publish it there.

https://nxpm.dev/docs/commands/registry Here is a tool to quickly run the registry and configure your NPM clients to look at that

linking the dependent package in the dist folder did work, although it’s not feasible to do this at scale. Thanks also for the pointer to verdaccio, i’ll check it out!

most monorepos I worked in have a script that does the linking for you, but it’s not always that straightforward.

Updated: