Ryan Wheale
Ryan Wheale

Reputation: 28410

`pnpm add` within a workspace does not add projects from workspace

I am working with a very simple monorepo with the following structure:

.npmrc
package.json
pnpm-workspaces.yml
packages/
  package-1/
  package-2/

When I cd into package-1, I am trying to add a reference to package-2 by doing the following:

pnpm add @myorg/package-2

But I get the error @myorg/package-2 is not in the npm registry, or you have no permission to fetch it.. I expect that pnpm add would detect that I'm inside a workspace and automatically link workspace packages. Am I missing something here?

Here is the relevant information you should need:

Upvotes: 9

Views: 13480

Answers (1)

Ryan Wheale
Ryan Wheale

Reputation: 28410

Ugh, I'm leaving this in case anybody else wants to feel embarrassed for themselves.

The pnpm-workspaces.yml should be named pnpm-workspace.yaml - I'm not sure where I got the other invalid name... but hopefully this helps you waste less time than I did.

Upvotes: 19

Related Questions