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

Peer dependency warnings #11982

Open
NiGhTTraX opened this issue Jan 24, 2022 · 8 comments
Open

Peer dependency warnings #11982

NiGhTTraX opened this issue Jan 24, 2022 · 8 comments

Comments

@NiGhTTraX
Copy link

Describe the bug

Doing a fresh install results in a lot of peer dep warnings.

Did you try recovering your dependencies?

❯ yarn --version              
1.22.0

Which terms did you search for in User Guide?

peer dependency warning

Environment

react-scripts@5.0.0.

Steps to reproduce

  1. yarn create react-app my-app

Expected behavior

No warnings of any kind.

Actual behavior

warning " > @testing-library/user-event@13.5.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".                                                                                                           
warning "react-scripts > tailwindcss@3.0.16" has unmet peer dependency "autoprefixer@^10.0.2".      
warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
warning "react-scripts > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.0" has unmet peer dependency "typescript@>= 2.7".
warning "react-scripts > webpack-dev-server > http-proxy-middleware@2.0.2" has unmet peer dependency "@types/express@^4.17.13".                
warning "react-scripts > eslint-config-react-app > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev |
| >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".                                                                                                                                                   
NiGhTTraX added a commit to NiGhTTraX/ts-monorepo that referenced this issue Jan 24, 2022
This reverts the workarounds for #159, #74 and #60, as they are no
longer needed.

There are a few peer dependency warnings, though the examples work just
fine:

- The one for NextJS is tracked in
vercel/next.js#31887.
- CRACO support for CRA@5 is tracked in
dilanx/craco#378.
- The warnings for CRA are tracked in
facebook/create-react-app#11982, except for
the `ts-jest` one which is expected, since we're using CRA's `jest`.
@naavis
Copy link

naavis commented Feb 23, 2022

I am encountering the same issue with yarn 1.22.15. As far as I have understood, there are differences in how Yarn and NPM look for peer dependencies, and NPM doesn't have this issue. But anyway, I'd expect react-scripts to install the needed peer dependencies, and not leave it up to the user of react-scripts.

@NiGhTTraX
Copy link
Author

pnpm 6.31 yields the same warnings:

 WARN  Issues with peer dependencies found
.
├─┬ @testing-library/user-event
│ └── ✕ missing peer @testing-library/dom@>=7.21.4
└─┬ react-scripts
  ├── ✕ missing peer typescript@"^3.2.1 || ^4"
  ├─┬ eslint-config-react-app
  │ ├─┬ @typescript-eslint/eslint-plugin
  │ │ ├── ✕ missing peer typescript@"*"
  │ │ └─┬ @typescript-eslint/type-utils
  │ │   ├── ✕ missing peer typescript@"*"
  │ │   └─┬ @typescript-eslint/utils
  │ │     └─┬ @typescript-eslint/typescript-estree
  │ │       ├── ✕ missing peer typescript@"*"
  │ │       └─┬ tsutils
  │ │         └── ✕ missing peer typescript@">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta"
  │ ├─┬ @typescript-eslint/parser
  │ │ └── ✕ missing peer typescript@"*"
  │ └─┬ eslint-plugin-flowtype
  │   ├── ✕ missing peer @babel/plugin-syntax-flow@^7.14.5
  │   └── ✕ missing peer @babel/plugin-transform-react-jsx@^7.14.9
  ├─┬ react-dev-utils
  │ └─┬ fork-ts-checker-webpack-plugin
  │   └── ✕ missing peer typescript@">= 2.7"
  └─┬ tailwindcss
    └── ✕ missing peer autoprefixer@^10.0.2
Peer dependencies that should be installed:
  @babel/plugin-syntax-flow@^7.14.5              autoprefixer@^10.0.2                           
  @babel/plugin-transform-react-jsx@^7.14.9      typescript@">=3.2.1 <4.0.0 || >=4.0.0 <5.0.0"  
  @testing-library/dom@>=7.21.4                  

@bestickley
Copy link

bestickley commented Mar 11, 2022

Could eslint-plugin-flowtype be made an optionalDependency for eslint-config-react-app? I use TypeScript for type checking and would prefer not to have warnings about it. Maybe other "non-core" dependencies could be marked as optionalDependencies too? Technically the typescript related packages could be considered "non-core" and marked as optional as well.

@lensbart
Copy link

I’m using Yarn 3.2.0 and get the following warning:

➤ YN0002: │ eslint-config-react-app@npm:7.0.0 [07f45] doesn't provide @babel/plugin-syntax-flow (p19435), requested by eslint-plugin-flowtype
➤ YN0002: │ eslint-config-react-app@npm:7.0.0 [07f45] doesn't provide @babel/plugin-transform-react-jsx (p74774), requested by eslint-plugin-flowtype

which can be muted by adding the following to .yarnrc.yml:

packageExtensions:
  # awaiting fix: https://github.com/facebook/create-react-app/issues/11982
  'eslint-plugin-flowtype@*':
    peerDependenciesMeta:
      '@babel/plugin-syntax-flow':
        optional: true
      '@babel/plugin-transform-react-jsx':
        optional: true

@bestickley
Copy link

@lensbart, excellent workaround. I used PNPM which also allows for this behavior. Thank you!

@T3rm1
Copy link

T3rm1 commented Apr 15, 2022

Would be nice if someone can fix this so we don't need a workaround.

@NiGhTTraX
Copy link
Author

FYI: pnpm@7 now has strict-peer-dependencies: true by default (pnpm/pnpm#4427) and errors out when installing CRA.

NiGhTTraX added a commit to NiGhTTraX/ts-monorepo that referenced this issue May 15, 2022
@IronCub3
Copy link

Someone knows if it got fixed? Because i'm still encountering this issue in my CRA with node 16.14.2 and cra 18.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants