yarn 3.x report missing peer dependencies for many nrwl packages
See original GitHub issueCurrent Behavior
Yarn 3.x report missing peer dependencies for many nrwl packages. It still works though, so no problem building or using nx.
Expected Behavior
Yarn 3.x doesn’t report as many missing peer dependencies as before… Yarn 3.x (and 4) works very well using nodeLinker in nx, and removing most noisy warnings from nx should be very easy, just add the missing peer dependencies. In my project yarn 1.22.19 can’t resolve the packages correctly (angular firebase project with latest firebase update), but yarn 3.x can… And I also noticed that it’s faster.
Steps to Reproduce
Enable corepack, add “packageManager”: “yarn@3.2.4” to package.json, and “nodeLinker: node-modules” and “enableGlobalCache: true” to .yarnrc.yml. Then run yarn.
Failure Logs
YN0002: │ @nrwl/angular@npm:14.8.4 doesn’t provide @types/node (p58824), requested by ts-node YN0002: │ @nrwl/angular@npm:14.8.4 doesn’t provide nx (p67646), requested by @nrwl/devkit YN0002: │ @nrwl/angular@npm:14.8.4 doesn’t provide rxjs (p8984e), requested by jasmine-marbles YN0002: │ @nrwl/angular@npm:14.8.4 doesn’t provide typescript (p89538), requested by @phenomnomnominal/tsquery YN0002: │ @nrwl/angular@npm:14.8.4 doesn’t provide typescript (pfb02a), requested by ts-node YN0002: │ @nrwl/cypress@npm:14.8.4 [8634b] doesn’t provide nx (p20dcb), requested by @nrwl/devkit YN0002: │ @nrwl/cypress@npm:14.8.4 [8634b] doesn’t provide typescript (pe4372), requested by @phenomnomnominal/tsquery YN0002: │ @nrwl/cypress@npm:14.8.4 [8634b] doesn’t provide typescript (p4e02b), requested by fork-ts-checker-webpack-plugin YN0002: │ @nrwl/cypress@npm:14.8.4 [8634b] doesn’t provide typescript (pf8b96), requested by ts-loader YN0002: │ @nrwl/cypress@npm:14.8.4 [eacac] doesn’t provide nx (p3a58a), requested by @nrwl/devkit YN0002: │ @nrwl/cypress@npm:14.8.4 [eacac] doesn’t provide typescript (p9edfd), requested by @phenomnomnominal/tsquery YN0002: │ @nrwl/cypress@npm:14.8.4 [eacac] doesn’t provide typescript (pe43c0), requested by fork-ts-checker-webpack-plugin YN0002: │ @nrwl/cypress@npm:14.8.4 [eacac] doesn’t provide typescript (p67588), requested by ts-loader YN0002: │ @nrwl/devkit@npm:14.8.4 [06034] doesn’t provide typescript (p5bfeb), requested by @phenomnomnominal/tsquery YN0002: │ @nrwl/devkit@npm:14.8.4 [d444f] doesn’t provide typescript (p1159a), requested by @phenomnomnominal/tsquery YN0002: │ @nrwl/eslint-plugin-nx@npm:14.8.4 [8634b] doesn’t provide eslint (pb486d), requested by @typescript-eslint/utils YN0002: │ @nrwl/eslint-plugin-nx@npm:14.8.4 [8634b] doesn’t provide nx (pf76a6), requested by @nrwl/devkit YN0002: │ @nrwl/jest@npm:14.8.4 doesn’t provide nx (ped2e9), requested by @nrwl/devkit YN0002: │ @nrwl/jest@npm:14.8.4 doesn’t provide typescript (p0f773), requested by @phenomnomnominal/tsquery YN0002: │ @nrwl/js@npm:14.8.4 doesn’t provide nx (p4e45e), requested by @nrwl/devkit YN0002: │ @nrwl/linter@npm:14.8.4 [8634b] doesn’t provide typescript (p458af), requested by @phenomnomnominal/tsquery YN0002: │ @nrwl/linter@npm:14.8.4 [eacac] doesn’t provide typescript (p09730), requested by @phenomnomnominal/tsquery YN0002: │ @nrwl/storybook@npm:14.8.4 doesn’t provide nx (pf5c36), requested by @nrwl/devkit YN0002: │ @nrwl/webpack@npm:14.8.4 doesn’t provide @babel/core (pbca72), requested by babel-loader YN0002: │ @nrwl/webpack@npm:14.8.4 doesn’t provide @types/node (paf088), requested by ts-node YN0002: │ @nrwl/webpack@npm:14.8.4 doesn’t provide nx (p87487), requested by @nrwl/devkit YN0002: │ @nrwl/webpack@npm:14.8.4 doesn’t provide typescript (p87e83), requested by fork-ts-checker-webpack-plugin YN0002: │ @nrwl/webpack@npm:14.8.4 doesn’t provide typescript (paf361), requested by ts-loader YN0002: │ @nrwl/webpack@npm:14.8.4 doesn’t provide typescript (peed8e), requested by ts-node
I can “fix” many of these by appending peer dependencies in .yarnrc.yaml like this:
packageExtensions:
"@nrwl/angular@*":
peerDependencies:
"@types/node": "*"
"nx": "*"
"typescript": "*"
"@nrwl/cypress@*":
peerDependencies:
"nx": "*"
"typescript": "*"
"@nrwl/devkit@*":
peerDependencies:
"typescript": "*"
"@nrwl/eslint-plugin-nx@*":
peerDependencies:
"eslint": "*"
"nx": "*"
"typescript": "*"
"@nrwl/jest@*":
peerDependencies:
"nx": "*"
"typescript": "*"
"@nrwl/js@*":
peerDependencies:
"nx": "*"
"typescript": "*"
"@nrwl/linter@*":
peerDependencies:
"typescript": "*"
"@nrwl/storybook@*":
peerDependencies:
"nx": "*"
"typescript": "*"
"@nrwl/webpack@*":
peerDependencies:
"@types/node": "*"
"nx": "*"
"typescript": "*"
"@nrwl/workspace@*":
peerDependencies:
"typescript": "*"
I have only added the most used transitive dependencies, and now yarn logs only this: YN0002: │ @nrwl/angular@npm:14.8.4 [8634b] doesn’t provide rxjs (pd6d9a), requested by jasmine-marbles YN0002: │ @nrwl/webpack@npm:14.8.4 [0e7fd] doesn’t provide @babel/core (p041f7), requested by babel-loader
Environment
Node : 16.17.1 OS : win32 x64 yarn : 4.0.0-rc.25
nx : 14.8.4 @nrwl/angular : 14.8.4 @nrwl/cypress : 14.8.4 @nrwl/detox : Not Found @nrwl/devkit : 14.8.4 @nrwl/esbuild : Not Found @nrwl/eslint-plugin-nx : 14.8.4 @nrwl/expo : Not Found @nrwl/express : Not Found @nrwl/jest : 14.8.4 @nrwl/js : 14.8.4 @nrwl/linter : 14.8.4 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/nx-cloud : Not Found @nrwl/nx-plugin : Not Found @nrwl/react : Not Found @nrwl/react-native : Not Found @nrwl/rollup : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 14.8.4 @nrwl/web : Not Found @nrwl/webpack : 14.8.4 @nrwl/workspace : 14.8.4 typescript : 4.8.4
Local workspace plugins:
Community plugins:
Issue Analytics
- State:
- Created a year ago
- Comments:9

Top Related StackOverflow Question
@atsjo maybe I did something wrong, but… if I use the
packageExtensionsas a workaround, I have to manually import rollup, which then breaks some NX scripts from executing.In my case, to silence all the warnings I had to add the following:
Which forces me to add both
@nrwl/webpackand@nrwl/rollupto my package.json… which break, for example, the commandnx workspace-lint:(which to me makes no sense because the version of everything is the correct one…)
Long story short, I think Nrwl should fix the issue, the same way ALL other dependencies did already.
Every repo will exhibit this issue I would think. @nrwl/angular doesn’t list nx as a peer dep, even if it depends on devkit, which does list it as a peer dep. The dependencies are of course in the repo, it’s just that yarn 3/4 warns that it’s not correctly declared in @nrwl/angular. If you try using yarn 3 as I described above in any repo, you would see a lot of warnings about peer deps in nrwl packages.
I also see in my comment above that I said this caused build warnings… That is not correct, I meant it causes warnings when running yarn.
The reason they want the packages to declare them, and not rely on transitive peer dependencies is what the article is about (I just found it as a reference in the yarn docs or a forum somewhere). I was a bit puzzled myself that the package managers can’t figure this out themself, I’m just observing that yarn 3/4 nags about it, yarn 1 didn’t.
packageExtensions is just a way to append missing deps, and I used it to remove the warnings from the nrwl packages, by appending the peer deps used by dependencies to the nrwl packages. I thought there would be no problem adding the peer deps as I did to the packages.
https://yarnpkg.com/getting-started/migration#fix-dependencies-with-packageextensions
https://yarnpkg.com/configuration/yarnrc#packageExtensions
Following the example of @nrwl/angular I used packageExtensions to add the following peer deps: