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

apollo-link-http package is incompatible with latest graphql #28

Open
inkiltie opened this issue Jun 10, 2022 · 0 comments
Open

apollo-link-http package is incompatible with latest graphql #28

inkiltie opened this issue Jun 10, 2022 · 0 comments

Comments

@inkiltie
Copy link

Recently I noticed that if you start from scratch with this boilerplate and run npm install or npm update there will be an incompatibility error, which also started bugging me during deployment on Netlify:

12:02:06 AM: npm ERR! code ERESOLVE
12:02:06 AM: npm ERR! ERESOLVE could not resolve
12:02:06 AM: npm ERR!
12:02:06 AM: npm ERR! While resolving: apollo-link-http@1.5.17
12:02:06 AM: Creating deploy upload records
12:02:06 AM: npm ERR! Found: graphql@16.0.1
12:02:06 AM: npm ERR! node_modules/graphql
12:02:06 AM: npm ERR!   graphql@"^16.0.1" from the root project
12:02:06 AM: npm ERR!   peer graphql@"^14.0.0 || ^15.0.0 || ^16.0.0" from @apollo/client@3.5.5
12:02:06 AM: npm ERR!   node_modules/@apollo/client
12:02:06 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
12:02:06 AM: npm ERR!     @apollo/client@"^3.5.5" from the root project
12:02:06 AM: npm ERR!     peer @apollo/client@"^3.2.5" from apollo3-cache-persist@0.14.0
12:02:06 AM: npm ERR!     node_modules/apollo3-cache-persist
12:02:06 AM: npm ERR!       apollo3-cache-persist@"^0.14.0" from the root project
12:02:06 AM: npm ERR!   2 more (@graphql-typed-document-node/core, graphql-tag)
12:02:06 AM: npm ERR!
12:02:06 AM: npm ERR! Could not resolve dependency:
12:02:06 AM: npm ERR! peer graphql@"^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" from apollo-link-http@1.5.17
12:02:06 AM: npm ERR! node_modules/apollo-link-http
12:02:06 AM: npm ERR!   apollo-link-http@"^1.5.17" from the root project
12:02:06 AM: npm ERR!
12:02:06 AM: npm ERR! Conflicting peer dependency: graphql@15.8.0
12:02:06 AM: npm ERR! node_modules/graphql
12:02:06 AM: npm ERR!   peer graphql@"^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" from apollo-link-http@1.5.17
12:02:06 AM: npm ERR!   node_modules/apollo-link-http
12:02:06 AM: npm ERR!     apollo-link-http@"^1.5.17" from the root project
12:02:06 AM: npm ERR!
12:02:06 AM: npm ERR! Fix the upstream dependency conflict, or retry
12:02:06 AM: npm ERR! this command with --force, or --legacy-peer-deps
12:02:06 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Forcing it with --force doesn't make sense to me, while --legacy-peer-deps will downgrade graphql package to 15.8.

So I dag deeper and realized that apollo-link-http package is over 2 years old and it's practically not that important because all its functionality is already present in @apollo/client itself.

Solution:

  1. Uninstall apollo-link-http
  2. Change client.js with the following: import { ApolloClient, ApolloLink, HttpLink, InMemoryCache } from "@apollo/client";, where HttpLink added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant