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

Fix dependency in api-routes example #29181

Merged
merged 4 commits into from Sep 17, 2021
Merged

Conversation

TyMick
Copy link
Contributor

@TyMick TyMick commented Sep 17, 2021

Installing the api-routes example app currently fails with npm because its react^17.0.2 dependency conflicts with its swr@0.1.18 dependency, as the latter has a peer dependency on react^16.11.0. Here's what I'm seeing when I try to install with create-next-app:

$ create-next-app --example api-routes --use-npm
✔ What is your project named? … my-app-npm
Creating a new Next.js app in ~/temp/my-app-npm.

Downloading files for example api-routes. This might take a moment.

Installing packages. This might take a couple of minutes.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.11.0" from swr@0.1.18
npm ERR! node_modules/swr
npm ERR!   swr@"0.1.18" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See ~/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2021-09-17T14_36_51_070Z-debug.log

Aborting installation.
  npm install has failed.

This PR upgrades SWR to the latest version, ^1.0.1, after which its React peer dependency no longer conflicts, installation succeeds with npm, and the example app continues to function (no migration is necessary in this case).

Documentation / Examples

  • Make sure the linting passes

@ijjk ijjk added the examples Issue/PR related to examples label Sep 17, 2021
Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ijjk ijjk merged commit 4452366 into vercel:canary Sep 17, 2021
@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants