pnpm / pnpm

Fast, disk space efficient package manager
https://pnpm.io
MIT License
29.41k stars 989 forks source link

`pnpm add` local package does not install nested deps #3900

Open lkho opened 2 years ago

lkho commented 2 years ago

pnpm version: 6.18.0

Code to reproduce the issue:

  1. clone https://github.com/lkho/test-pnpm-local-dep
  2. $ pnpm add ./local/package1
  3. $ pnpm install
  4. $ node index.js

Expected behavior:

index.js should run successfully without errors.

Actual behavior:

package addition is not installed in anywhere, and nodejs errored when require('addition') in .\local\package1\index.js

The docs (https://pnpm.io/cli/add#install-from-local-file-system) says pnpm add is same as pnpm link on a local directory. But it isn't, and it should NOT (in my opinion). It is weird that pnpm link does install the nested dep correctly, inside the local dir (but didn't modify package.json), whereas pnpm add don't.

Additional information:

zkochan commented 2 years ago

When the local directory is in a subdirectory it makes sense to create a workspace and it will work as you expect.

willcrichton commented 4 months ago

I think this feature should be supported separately from workspaces. For example, if I have two separate workspaces and I want to locally import a package from one workspace into another, then the nested dependencies need to be carried with the imported package.

brabeji commented 2 weeks ago

I need to quickly verify local changes to a library in another local package where my demo app is located. This is not a case for workspaces.