-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
NextJs 13 - Unable to render components client-side using use client;
#42024
Comments
@kukicado do you use async to fetch data in one of the components? this does not work in client components. |
@philipheinser nope. I removed all functionality from the components to try to isolate the issue. The components don't do anything other than return a message. The only difference is that I am including the |
I also recreated the repo on stackblitz (https://stackblitz.com/edit/vercel-next-js-p1gsmj?file=next.config.js,app%2Fpage.tsx,app%2Flayout.tsx,app%2F[post]%2Fpage.tsx,app%2F[post]%2F[comment]%2Fpage.tsx) and am not able to reproduce the issue there. I wonder if this is perhaps Windows related? |
Just to confirm that it's not just your machine, I've cloned the repo and ran it and got the same issue. Removing I just wanted to check this since I've ran into same issues, but wasn't sure if I was just doing something wrong 😄 Windows 11 21H2 (OS Build 220000.1098) |
Same error on Windows 10, nextjs 13.0.1-canary and a regular nextjs config file:
It's a monorepo (turborepo) |
It seems like a Windows specific bug. I will investigate. |
Can confirm this only seems to happen on Windows, I'm running Windows 11 Pro 22H2 (22621.674) with Next 13.0.2-canary.0 and the same project works fine on Ubuntu 20.04 (either native or on WSL) So for anyone else having this issue a work around if you are developing on Windows is to use WSL. |
In Windows absolute paths start with things like `C:\` instead of `/`. This PR closes #42024 as I confirmed the reproduction app is working properly with this fix. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] 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 - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
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. |
Verify canary release
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 16.18.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 13.0.1-canary.0
eslint-config-next: 13.0.0
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
Chrome Version 106.0.5249.119
How are you deploying your application? (if relevant)
npm run dev
Describe the Bug
In trying to use the new
app
directory way of setting up an application and trying to mix server-renderer components and client-side rendered components often time fails with a cryptic error. To render components client-side, I am just using the "use client"; command at the top of the component. Removing this and rendering the all the components server-side works fine without issue. The reason for using client-side components is to bring in React client side functionality.Expected Behavior
Component should render client side.
Link to reproduction
https://github.com/kukicado/next13-useclient-issue
To Reproduce
Error displayed:
The text was updated successfully, but these errors were encountered: