monorepopnpmpnpm-workspace

How to run pnpm on a nested folder that is _not_ part of workspace setup?


How can I run pnpm on a nested package that is not supposed to be part of a workspace inside a monorepo? Say I have

root
├── packages
│   ├── foo
│   └── bar
├── non-workspaced-packages  
│   └── baz
├── pnpm-workspace.yaml
…

And a pnpm-workspace.yaml:

packages:
   - 'packages/**'

If I go into non-workspaced-packages/baz and hit pnpm install it still runs in the context of the root workspace. I can't seem to find a way to run pnpm in a folder nested inside something with a .pnpm-workspace.yaml without pnpm wanting to do the workspace thing…?

Related - I think this was the same question but in that case was misunderstood: How to set up an examples folder with Turborepo and pnpm?


Solution

  • I think you want the --ignore-workspace flag:

    pnpm --ignore-workspace install
    

    I found it in this GitHub Discussion. I'm not sure why it isn't documented.