question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

yarn 3.x report missing peer dependencies for many nrwl packages

See original GitHub issue

Current 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:closed
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
pongellscommented, Oct 27, 2022

@atsjo maybe I did something wrong, but… if I use the packageExtensions as 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:

packageExtensions:
  "@nrwl/cypress@*":
     peerDependencies:
       nx: "*"
       typescript: "*"
  "@nrwl/devkit@*":
    peerDependencies:
      typescript: "*"
  "@nrwl/eslint-plugin-nx@*":
    peerDependencies:
      nx: "*"
      eslint: "*"
      typescript: "*"
  "@nrwl/jest@*":
    peerDependencies:
      nx: "*"
      typescript: "*"
  "@nrwl/js@*":
    peerDependencies:
      nx: "*"
      typescript: "*"
  "@nrwl/linter@*":
    peerDependencies:
      typescript: "*"
  "@nrwl/react@*":
    peerDependencies:
      nx: "*"
      typescript: "*"
      "@types/node": "*"
  "@nrwl/rollup@*":
    peerDependencies:
      nx: "*"
      typescript: "*"
      "@babel/core": "*"
  "@nrwl/storybook@*":
    peerDependencies:
      nx: "*"
      typescript: "*"
  "@nrwl/web@*":
    peerDependencies:
      nx: "*"
      typescript: "*"
      "@types/node": "*"
  "@nrwl/webpack@*":
    peerDependencies:
      nx: "*"
      typescript: "*"
      "@babel/core": "*"
      "@types/node": "*"
  "@nrwl/workspace@*":
    peerDependencies:
      typescript: "*"

Which forces me to add both @nrwl/webpack and @nrwl/rollupto my package.json… which break, for example, the command nx workspace-lint:

>  NX   Some packages have misaligned versions!
   These packages should match your installed version of Nx.
   - @nrwl/rollup@^15.0.3
   You should be able to fix this by running `nx migrate 15.0.3`

(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.

% yarn                  
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @nrwl/cypress@npm:15.0.3 [70764] doesn't provide nx (p1e39a), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/cypress@npm:15.0.3 [70764] doesn't provide typescript (p82f5f), requested by @phenomnomnominal/tsquery
➤ YN0002: │ @nrwl/cypress@npm:15.0.3 [70764] doesn't provide typescript (p93771), requested by fork-ts-checker-webpack-plugin
➤ YN0002: │ @nrwl/cypress@npm:15.0.3 [70764] doesn't provide typescript (pc66a0), requested by ts-loader
➤ YN0002: │ @nrwl/cypress@npm:15.0.3 [9c3a8] doesn't provide nx (p2ec4d), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/cypress@npm:15.0.3 [9c3a8] doesn't provide typescript (pc889d), requested by @phenomnomnominal/tsquery
➤ YN0002: │ @nrwl/cypress@npm:15.0.3 [9c3a8] doesn't provide typescript (p05b0e), requested by fork-ts-checker-webpack-plugin
➤ YN0002: │ @nrwl/cypress@npm:15.0.3 [9c3a8] doesn't provide typescript (p14404), requested by ts-loader
➤ YN0002: │ @nrwl/devkit@npm:15.0.3 [472f3] doesn't provide typescript (pdf2d7), requested by @phenomnomnominal/tsquery
➤ YN0002: │ @nrwl/devkit@npm:15.0.3 [c41ac] doesn't provide typescript (pb1e27), requested by @phenomnomnominal/tsquery
➤ YN0002: │ @nrwl/eslint-plugin-nx@npm:15.0.3 [9c3a8] doesn't provide eslint (p96e37), requested by @typescript-eslint/utils
➤ YN0002: │ @nrwl/eslint-plugin-nx@npm:15.0.3 [9c3a8] doesn't provide nx (padf44), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/jest@npm:15.0.3 doesn't provide nx (p8b348), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/jest@npm:15.0.3 doesn't provide typescript (p4c49e), requested by @phenomnomnominal/tsquery
➤ YN0002: │ @nrwl/js@npm:15.0.3 doesn't provide nx (pfbede), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/linter@npm:15.0.3 [692a0] doesn't provide typescript (pf9ac6), requested by @phenomnomnominal/tsquery
➤ YN0002: │ @nrwl/linter@npm:15.0.3 [9c3a8] doesn't provide typescript (p88431), requested by @phenomnomnominal/tsquery
➤ YN0002: │ @nrwl/react@npm:15.0.3 doesn't provide nx (pe71f7), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/react@npm:15.0.3 doesn't provide typescript (pb3134), requested by @phenomnomnominal/tsquery
➤ YN0002: │ @nrwl/rollup@npm:15.0.3 doesn't provide @babel/core (p2f3fa), requested by @rollup/plugin-babel
➤ YN0002: │ @nrwl/rollup@npm:15.0.3 doesn't provide nx (pfe2a8), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/rollup@npm:15.0.3 doesn't provide typescript (p7a10f), requested by rollup-plugin-typescript2
➤ YN0002: │ @nrwl/storybook@npm:15.0.3 doesn't provide nx (p585fb), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/web@npm:15.0.3 doesn't provide nx (pc8292), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/webpack@npm:15.0.3 doesn't provide @babel/core (p10880), requested by babel-loader
➤ YN0002: │ @nrwl/webpack@npm:15.0.3 doesn't provide @types/node (p3ffdb), requested by ts-node
➤ YN0002: │ @nrwl/webpack@npm:15.0.3 doesn't provide nx (p8a765), requested by @nrwl/devkit
➤ YN0002: │ @nrwl/webpack@npm:15.0.3 doesn't provide typescript (pe7ae3), requested by fork-ts-checker-webpack-plugin
➤ YN0002: │ @nrwl/webpack@npm:15.0.3 doesn't provide typescript (p6f54d), requested by ts-loader
➤ YN0002: │ @nrwl/webpack@npm:15.0.3 doesn't provide typescript (p3e0fe), requested by ts-node
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 245ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0s 321ms
➤ YN0000: Done with warnings in 0s 778ms

1reaction
atsjocommented, Oct 16, 2022

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:

"@nrwl/angular@*":
  peerDependencies:
    "@types/node": "*"    // since ts-node has peer dep on @types/node
    "nx": "*"            // since @nrwl/devkit has peer dep on nx
    "typescript": "*"   // since ts-node and @phenomnomnominal/tsquery have peer dep on typescript 
Read more comments on GitHub >

github_iconTop Results From Across the Web

yarn 2 / Plug N Play Support · Issue #2386 · nrwl/nx - GitHub
I am seeing the same issue here and disappointed NX CLI is ... yarn 3.x report missing peer dependencies for many nrwl packages...
Read more >
check-peer-dependencies | Yarn - Package Manager
This utility will recursively find all peerDependencies in your project's dependencies list. It checks if you have installed a package that meets the ......
Read more >
ESLint - npm
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and...
Read more >
@nrwl/linter - NPM Package Overview - Socket
Start using Socket to analyze @nrwl/linter and its 4 dependencies to secure your app ... core: consult root package.json when resolving peer deps...
Read more >
What does 'has unmet peer dependency' mean when ...
Peer dependencies were automatically installed up until npm@3 (which yarn ... or just yarn install can fix the issue and install the missing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found