Closed MRezaSafari closed 1 year ago
@MRezaSafari Is this with pages or appDir? What versions of react and react-dom are you on?
Does setting __NEXT_PRIVATE_PREBUNDLED_REACT=next
environment variable help? as some are suggesting here https://github.com/vercel/next.js/issues/49169.
I can confirm that the environment variable above is working for next@13.4.1
and @nx@16.1
. Thanks @jaysoo !
Edit: this is with appDir and react@18.2.0
Is there a way to fix this without needing the environment variable?
@mhar-andal Thanks for verifying. This is the workaround for now. You can set it in your next.config.js
or.env
file.
#.env
# or 'experimental' if serverActions is enabled
__NEXT_PRIVATE_PREBUNDLED_REACT=next
Edit: Setting in next.config.js is too late and will cause two different React renderers to load. Use .env
instead.
We are preparing for the Nx 16.2.0 release, which will come with Next.js 13.4 by default and fix issues like this by invoking the Next.js CLI directly.
@jaysoo Thanks a lot. It's working for me using a .env file.
happens on netlify with 13.4.1 and can't set __NEXT_PRIVATE_PREBUNDLEDREACT=next because it starts with
I get the same as @tholder
May 6, 01:36:27 PM: b8e6b8e3 ERROR Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server.edge' is not defined by "exports" in /var/task/node_modules/react-dom/package.json
at new NodeError (node:internal/errors:387:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:365:9)
at packageExportsResolve (node:internal/modules/esm/resolve:649:3)
at resolveExports (node:internal/modules/cjs/loader:554:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:594:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1012:27)
at /var/task/node_modules/next/dist/server/require-hook.js:180:36
at Function.Module._load (node:internal/modules/cjs/loader:871:27)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}May 6, 01:36:27 PM: b8e6b8e3 INFO [GET] / (SSR)May 6, 01:36:27 PM: b8e6b8e3 Duration: 100.46 ms Memory Usage: 137 MB
fixed on 16.1.1. thanks everyone!
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.
Current Behavior
Receiveing error
event - compiled client and server successfully in 2.8s (684 modules) wait - compiling... [ ready ] on http://localhost:4200 event - compiled client and server successfully in 1296 ms (684 modules) wait - compiling /page (client and server)... event - compiled client and server successfully in 18.8s (8718 modules) wait - compiling... error - Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server.edge' is not defined by "exports" in /Users/m/Development/XX/Frontend/node_modules/react-dom/package.json
Expected Behavior
run successfuly
GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs
Additional Information
No response