Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[turborepo] turbo prune ignore local peerDependencies #4915

Open
Naymi opened this issue May 12, 2023 · 8 comments
Open

[turborepo] turbo prune ignore local peerDependencies #4915

Naymi opened this issue May 12, 2023 · 8 comments
Assignees
Labels
kind: bug Something isn't working owned-by: turborepo

Comments

@Naymi
Copy link

Naymi commented May 12, 2023

What version of Turborepo are you using?

1.9.4

What package manager are you using / does the bug impact?

npm

What operating system are you using?

Mac

Describe the Bug

turbo prune ignore local peer deps

Expected Behavior

turbo prune respects peerDependencies

To Reproduce

git clone https://github.com/Naymi/turbo-prune-ignore-peer-demo
npx turbo prune --scope depend-on-tested

out will only be depend-on-tested

Reproduction Repo

https://github.com/Naymi/turbo-prune-ignore-peer-demo

@Naymi Naymi added area: turborepo kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels May 12, 2023
@gravelg
Copy link

gravelg commented May 12, 2023

I am also being hit with this problem. I imagine this is due to the change in #4824

It seems that the lockfile generated by turbo prune is no longer usable by default when using npm ci, as npm expects to install peerDependencies by default since npm 7

I've updated to pass the --legacy-peer-deps flag and it has fixed the issue on some workspaces but not all. Downgrading to turbo v1.9.3 fixes the problem.

@Naymi
Copy link
Author

Naymi commented May 12, 2023

Меня тоже мучает эта проблема. Я предполагаю, что это связано с изменением # 4824

Кажется, что файл заблокирован, сгенерирован с помощью , turbo pruneбольше не используется по умолчанию при сборке npm ci, так как npm ожидает установки peerDependencies по умолчанию, природа с npm 7.

Я обновил, чтобы передать --legacy-peer-deps, и это устранило проблему в некоторых рабочих группах, но не во всех. Переход на турбо версию 1.9.3 решает проблему.

This won't fix the problem since peerDependencies are local

@gravelg
Copy link

gravelg commented May 12, 2023

You are right, my issue is not exactly the same as yours. I'm having trouble with missing peerDependencies from (I believe) jest

#20 2.868 npm ERR! Missing: @swc/core@1.3.57 from lock file
#20 2.869 npm ERR! Missing: @swc/core-darwin-arm64@1.3.57 from lock file
#20 2.870 npm ERR! Missing: @swc/core-darwin-x64@1.3.57 from lock file
#20 2.871 npm ERR! Missing: @swc/core-linux-arm-gnueabihf@1.3.57 from lock file
#20 2.872 npm ERR! Missing: @swc/core-linux-arm64-gnu@1.3.57 from lock file
#20 2.872 npm ERR! Missing: @swc/core-linux-arm64-musl@1.3.57 from lock file
#20 2.874 npm ERR! Missing: @swc/core-linux-x64-gnu@1.3.57 from lock file
#20 2.875 npm ERR! Missing: @swc/core-linux-x64-musl@1.3.57 from lock file
#20 2.876 npm ERR! Missing: @swc/core-win32-arm64-msvc@1.3.57 from lock file
#20 2.877 npm ERR! Missing: @swc/core-win32-ia32-msvc@1.3.57 from lock file
#20 2.879 npm ERR! Missing: @swc/core-win32-x64-msvc@1.3.57 from lock file
#20 2.880 npm ERR! Missing: react@18.2.0 from lock file
#20 2.881 npm ERR! Missing: react-dom@18.2.0 from lock file
#20 2.882 npm ERR! Missing: scheduler@0.23.0 from lock file

@rskvazh
Copy link

rskvazh commented May 15, 2023

Same problem. 1.9.4 prune peer dependencies and when npm ci I've got error: Missing: svelte@3.59.1 from lock file

@chris-olszewski chris-olszewski removed the needs: triage New issues get this label. Remove it after triage label May 15, 2023
@chris-olszewski chris-olszewski self-assigned this May 15, 2023
chris-olszewski added a commit that referenced this issue May 16, 2023
### Description

In #4824 I removed the peer dependencies when collecting all
dependencies for a package. This is correct behavior for npm3-6, but is
overly strict for npm7+ as npm will automatically install peer
dependencies if they aren't provided. This partially addresses #4915,
but doesn't handle the case where a workspace has peer dependencies that
the host package doesn't provide. I will address that, but that requires
a much larger change to how we construct the workspace graph and
extending our package manager interface.

### Testing Instructions

Tests added in ##4824 still pass along with a new unit test that
verifies we pick up peer dependencies

---------

Co-authored-by: Chris Olszewski <Chris Olszewski>
@Naymi
Copy link
Author

Naymi commented May 29, 2023

Still relevant!

@bernardobelchior
Copy link

Just faced this as well. Would be nice to have a fix!

@ljuborados
Copy link

We're facing the same issue.
We're stuck on 1.9.3 until this is fixed.

@attila
Copy link

attila commented Dec 6, 2023

This is still outstanding unfortunately.

We recently got bit by this and only a workaround helped where:

  1. get the list of changed workspaces via turbo run build --filter='...[base-branch]' --dry-run=json | jq -r '.packages | map(select(. != "//")) | join(" ")')
  2. take the list of local package names, and then check if any of them have local peers defined by parsing the lockfile
  3. add any extra local packages names to the list as discovered above
  4. call turbo prune --out-dir=<path> <list of changed workspaces and their local peers>
  5. install dependencies then build the pruned repo as normal

Steps 2-3. contain our workaround to our monorepo of 100+ workspaces, that is only needed until the issue reported here is resolved.

Without the workaround, step 5 would fail at the installation by npm erroring out on missing local peer definitions (and because the custom prefixed local package names are not on any remote registries)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working owned-by: turborepo
Projects
None yet
Development

No branches or pull requests

9 participants