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

Error: Next.js requires React 18.2.0 to be installed. #41975

Closed
1 task done
craigwheeler opened this issue Oct 27, 2022 · 6 comments · Fixed by #42027
Closed
1 task done

Error: Next.js requires React 18.2.0 to be installed. #41975

craigwheeler opened this issue Oct 27, 2022 · 6 comments · Fixed by #42027
Labels
examples Issue/PR related to examples good first issue Easy to fix issues, good for newcomers

Comments

@craigwheeler
Copy link
Contributor

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Currently trying to deploy on Vercel

Which example does this report relate to?

with-supabase-auth-realtime-db

What browser are you using? (if relevant)

Chrome Version 106.0.5249.119 (Official Build) (x86_64)

How are you deploying your application? (if relevant)

Vercel

Describe the Bug

Attempted to deploy a new project using the with-supabase-auth-realtime-db template for Supabase Authentication found here, however, I seem to be receiving dependency warnings that are causing the build to fail?

New Project – Vercel 2022-10-27 09-57-06

Deployment failed with error:

[09:16:24.569] Cloning gitlab.com/craig_wheeler/nextjs-with-supabase-auth (Branch: main, Commit: e78a1b7)
[09:16:25.622] Cloning completed: 1.053s
[09:16:25.865] Looking up build cache...
[09:16:25.993] Build Cache not found
[09:16:26.044] Running "vercel build"
[09:16:26.687] Vercel CLI 28.4.12-05a80a4
[09:16:27.081] Installing dependencies...
[09:16:27.510] yarn install v1.22.17
[09:16:27.543] info No lockfile found.
[09:16:27.552] [1/4] Resolving packages...
[09:16:29.894] [2/4] Fetching packages...
[09:16:48.103] [3/4] Linking dependencies...
[09:16:48.105] warning " > next@13.0.0" has incorrect peer dependency "react@^18.0.0-0".
[09:16:48.105] warning " > next@13.0.0" has incorrect peer dependency "react-dom@^18.0.0-0".
[09:16:52.907] [4/4] Building fresh packages...
[09:16:53.204] success Saved lockfile.
[09:16:53.210] Done in 25.71s.
[09:16:53.239] Detected Next.js version: 13.0.0
[09:16:53.242] Running "yarn run build"
[09:16:53.581] yarn run v1.22.17
[09:16:53.617] $ next build
[09:16:54.824] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[09:16:54.825] This information is used to shape Next.js' roadmap and prioritize features.
[09:16:54.825] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[09:16:54.825] https://nextjs.org/telemetry
[09:16:54.825] 
[09:16:55.852] info  - Linting and checking validity of types...
[09:16:56.147] info  - Creating an optimized production build...
[09:16:56.208] 
[09:16:56.209] > Build error occurred
[09:16:56.212] Error: Next.js requires React 18.2.0 to be installed.
[09:16:56.212]     at Object.getBaseWebpackConfig [as default] (/vercel/path0/node_modules/next/dist/build/webpack-config.js:59:19)
[09:16:56.213]     at async Promise.all (index 0)
[09:16:56.213]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[09:16:56.213]     at async /vercel/path0/node_modules/next/dist/build/index.js:449:33
[09:16:56.213]     at async /vercel/path0/node_modules/next/dist/build/index.js:433:13
[09:16:56.214]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[09:16:56.214]     at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:64:29)
[09:16:56.233] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[09:16:56.255] Error: Command "yarn run build" exited with 1

Expected Behavior

Build should be passing without warnings or errors

To Reproduce

Following the documentation outlined here and clicking the "Deploy" button and follow the steps to configure the Project and deploy it.

  1. Selected GitLab
  2. Click create
  3. Click Add under Add Integrations
  4. New window will open then click Deploy for New Empty Database
  5. Choose organization and click continue
  6. Create project name and click create project

Project will begin to deploy but fail with the following error:

Error: Next.js requires React 18.2.0 to be installed.
@craigwheeler craigwheeler added the examples Issue/PR related to examples label Oct 27, 2022
@AlphaNecron
Copy link

Check your package.json, next@13 has raised react requirement to 18`.

@craigwheeler
Copy link
Contributor Author

I agree since the minimum React version has been bumped from 17.0.2 to 18.2.0. found here, however, this dependency is coming from the deploy template provided by Next.js found here so it should be updated.

{
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "@supabase/supabase-js": "^1.2.1",
    "@supabase/ui": "^0.36.2",
    "next": "latest",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "swr": "1.1.2"
  }
}

@AlphaNecron
Copy link

There are hundred of templates so it's not easy to update all of them though.

@balazsorban44 balazsorban44 added the good first issue Easy to fix issues, good for newcomers label Oct 27, 2022
@balazsorban44
Copy link
Member

@AlphaNecron a simple "replace all" is likely sufficient. IDEs like VSCode make this quite easy, want to open a PR? 🙂

@craigwheeler
Copy link
Contributor Author

Hi @balazsorban44 👋 ... opened #42027 to update the minimum version of React used by examples from 17.0.2 to 18.2.0.

@kodiakhq kodiakhq bot closed this as completed in #42027 Oct 28, 2022
kodiakhq bot pushed a commit to ijjk/next.js that referenced this issue Oct 28, 2022
This PR updates the minimum version of React used by examples from 17.0.2 to 18.2.0.

Fixes vercel#41975

## Bug

- [x] Related issues linked using `fixes vercel#41975`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 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 good first issue Easy to fix issues, good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants