profile
viewpoint

Ask questionsFresh new install gives unmet peer dependencies warnings with yarn

Intended outcome:

I tried to start a new Apollo project, based on the documentation I issued:

yarn add react react-dom apollo-boost @apollo/react-hooks graphql

Which gave:

warning "@apollo/react-hooks > @apollo/react-common@3.0.1" has unmet peer dependency "@types/react@^16.8.0".
warning "@apollo/react-hooks > @apollo/react-common@3.0.1" has unmet peer dependency "apollo-client@^2.6.4".
warning "@apollo/react-hooks > @apollo/react-common@3.0.1" has unmet peer dependency "apollo-utilities@^1.3.2".
warning " > @apollo/react-hooks@3.0.1" has unmet peer dependency "@types/react@^16.8.0".
warning " > @apollo/react-hooks@3.0.1" has unmet peer dependency "apollo-client@^2.6.4".

Actual outcome:

I would expect either no warnings or those peer deps being mentioned in the documentation

Note that with npm instead of yarn, I only get those warnings:

npm WARN @apollo/react-hooks@3.0.1 requires a peer of @types/react@^16.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/react-common@3.0.1 requires a peer of @types/react@^16.8.0 but none is installed. You must install peer dependencies yourself.

How to reproduce the issue:

yarn init yarn add react react-dom apollo-boost @apollo/react-hooks graphql

Version

System:
    OS: macOS 10.14.5
  Binaries:
    Node: 10.14.2 - ~/.nvm/versions/node/v10.14.2/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.14.2/bin/npm
  Browsers:
    Chrome: 76.0.3809.100
    Firefox: 68.0.2
    Safari: 12.1.1
  npmPackages:
    apollo-boost: ^0.4.4 => 0.4.4
apollographql/react-apollo

Answer questions Tylerian

Thing is yarn complains even when the required peer dependencies are already installed if the version is mismatching.

for example in my project I'm using react@latest(16.10.2) and the following shows in yarn: warning " > @apollo/react-hooks@3.1.3" has unmet peer dependency "react@^16.8.0".

Is this desired behavior?

useful!

Related questions

Using MockedProvider results in error "No more mocked responses for the query: ..." hot 3
useLazyQuery execution function should return a promise hot 2
Upgrading to 3.0.1 gives the following: Invariant violation: Could not find "client" hot 2
"Invalid hook call." error while using `Query` or `useQuery` with react-apollo 3 hot 1
currentObservable.query.fetchMore is not a function - react-apollo hot 1
MockedProvider can't mock queries with client directives hot 1
Attempted import error: 'compose' is not exported from 'react-apollo' hot 1
Query result proposal: use actual data or {} to enable easier destructuring hot 1
currentObservable.query.getCurrentResult is not a function hot 1
Apollo MockedProvider with client directives hot 1
Could not find "client" in the context of ApolloConsumer when using react-apollo 2.5.3 with MockedProvider hot 1
useQuery infinite loop re-rendering - react-apollo hot 1
watchQuery is not a function - react-apollo hot 1
MockedProvider does not return data when fetchPolicy is set to "cache-and-network" - react-apollo hot 1
MockProvider is not reporting results.errors hot 1
source:https://uonfu.com/
Github User Rank List