fix(core): don't set legacy-peer-deps by default #29726
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Behavior
Currently certain actions, notably
nx release
, runnpm
withlegacy-peer-deps
enabled. This is an issue because running withlegacy-peer-deps
turned when it is normally off (which is the default) causes the installed dependency graph to be different. This then can break other scripts that expect the structure to be the same, includingnpm ci
.Changing the value of
legacy-peer-deps
causes npm to install a different graph, which can break builds and thenpm ci
command. Any users who rely onlegacy-peer-deps
should already have it set in an.npmrc
file, so this should not affect them. It does, however, fix bugs with usingnx
in repos that don't havelegacy-peer-deps
enabled, which is the vast majority of them.Expected Behavior
Running
nx
commands, especiallynx release
, shouldn't change the structure of the installed packages at all.Related Issue(s)
Fixes #22066
Fixes #29537
Note: I was unable to fully test this locally because the
e2e
target the contribution guide says to run no longer exists, and trying to rune2e-local
fails withError: Jest: Got error running globalSetup - /workspaces/nx/e2e/utils/global-setup.ts, reason: 1
(example run). I tried asking about this error in the Discord, but didn't get a reply, so I'm just posting this PR anyway in the hopes that CI passes.