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:
@myorg/[package-name]
convention inside of package.json "name" field.packages:
- 'packages/**'
link-workspace-packages = true
prefer-workspace-packages = true
recursive-install = true
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.