-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
[When using yarn PNP] TypeError: Cannot read properties of undefined (reading 'on') #46993
Comments
I get the same error using regular old npm. Just running |
Ok, after some digging, this can be reproduced with a fresh project created with experimental: {
workerThreads: true
} I forget why I added that. I actually used yarn pnp in the past and switched back to default npm so it's likely an artifact leftover from some solution I found in nextjs issues to fix a yarn pnp issue. Removing that does seem to fix it, but I don't know if that will be possible for everyone. |
You're right. I had that enabled too but removing it seems to have no effect. It was somehow required for pnp before but not anymore. |
Fixes #46993. The issue is introduced in #46705 by @ijjk Next.js uses `jest-worker` for multiprocessing. `jest-worker` supports both `child_process` and `worker_threads` modes. Next.js use `child_process` mode by default, but can also switch to using `worker_threads` mode with an experimental flag `config.experimental.workerThreads`. In #46705, @ijjk applies a fix that works for the `child_process` mode, which breaks the `worker_threads` mode (`jest-worker`'s `NodeThreadWorker` interface doesn't have the private property `_child`), causing static HTML export to fail with the following error (#46993): ``` > Build error occurred TypeError: Cannot read properties of undefined (reading 'on') at createWorker (/Users/[redacted]/node_modules/next/dist/lib/worker.js:32:31) at new Worker (/Users/[redacted]/node_modules/next/dist/lib/worker.js:42:9) at /Users/[redacted]/node_modules/next/dist/build/index.js:629:35 at async Span.traceAsyncFn (/Users/[redacted]/node_modules/next/dist/trace/trace.js:79:20) at async Object.build [as default] (/Users/[redacted]/node_modules/next/dist/build/index.js:74:29) ``` The PR fixes that.
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: darwin Arch: arm64 Version: Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 Binaries: Node: 19.6.1 npm: 9.4.0 Yarn: 4.0.0-rc.40 pnpm: N/A Relevant packages: next: 13.2.4 eslint-config-next: 13.2.4 react: 18.2.0 react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
To Reproduce
Use yarn pnp and build app.
It was introduces in this PR #46705 I believe
next.js/packages/next/src/lib/worker.ts
Line 51 in 05f6de1
Describe the Bug
Expected Behavior
No error. 13.2.1 works
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: