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

Default Next.js app fails to build in brand new workspace #9768

Closed
tundera opened this issue Apr 9, 2022 · 6 comments
Closed

Default Next.js app fails to build in brand new workspace #9768

tundera opened this issue Apr 9, 2022 · 6 comments
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@tundera
Copy link

tundera commented Apr 9, 2022

Current Behavior

After creating a new Nx workspace with a Next.js application, the Next.js app fails to build even though no changes have been made to the app.

Expected Behavior

Builds should succeed for new, unchanged Next.js apps in a freshly generated workspace.

Steps to Reproduce

Here's a reproduction of the issue using Codesandbox. The Next.js app will run fine in the sandbox, but opening a new terminal window and attempting to build to will result in an error.

Failure Logs

CleanShot 2022-04-09 at 10 18 36

Environment

 >  NX   Report complete - copy this into the issue template

   Node : 16.14.0
   OS   : darwin x64
   yarn : 1.22.17
   
   nx : 13.10.1
   @nrwl/angular : Not Found
   @nrwl/cypress : 13.10.1
   @nrwl/detox : Not Found
   @nrwl/devkit : 13.10.1
   @nrwl/eslint-plugin-nx : 13.10.1
   @nrwl/express : Not Found
   @nrwl/jest : 13.10.1
   @nrwl/js : 13.10.1
   @nrwl/linter : 13.10.1
   @nrwl/nest : Not Found
   @nrwl/next : 13.10.1
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 13.2.2
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 13.10.1
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 13.10.1
   @nrwl/web : 13.10.1
   @nrwl/workspace : 13.10.1
   typescript : 4.6.3
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

Done in 0.77s.
@gioragutt
Copy link
Contributor

Idk if this is related, I saw there might be a version mismatch between react and types/react after the react18 migration, perhaps this is the cause?
Could you check your package json versions of react packages?

@vincent-thomas
Copy link

I think the error may be in the tsconfig.json. change jsx-transpilation to preserve or react-jsx

@rldnrl
Copy link

rldnrl commented Apr 10, 2022

I also got an error in the same part. This is because the @types/react and @types/react-dom versions are not updated.

My Solution

I manually updated to fix this issue.

image

@tundera
Copy link
Author

tundera commented Apr 10, 2022

@rldnrl Yep, this is what will fix the issue. Just upgrade the @types/react and @types/react-dom versions to latest and the build succeeds. So the fix should be to update the templates to use the new types packages for react and react-dom. It looks like this will be addressed in #9767

@jaysoo jaysoo added the scope: nextjs Issues related to NextJS support for Nx label Apr 11, 2022
@ndcunningham
Copy link
Contributor

Should be fixed with: #9767

If the problem still persist please feel free to open

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

6 participants