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
jest-worker breaks building the project with "write EPIPE" error on macOS #27000
Comments
The same problem! My build is running in docker and periodically crashes with this error! Next.js: 11.0.1
Downgrading to version 10.2.3 solves the problem. And yes, we're on yarn 2 and PnP. |
We've been fighting this as well as part of our attempt to upgrade to Next.js 11. We're not entirely sure what's causing it but some observations are:
|
These two issues might be related:
|
This option in module.exports = {
experimental: {
cpus: 1,
},
}; It affects how next.js/packages/next/build/index.ts Line 675 in d60c95c
Specifically for jest-worker, it sets const workerPoolOptions: WorkerPoolOptions = {
numWorkers: this._options.numWorkers ?? Math.max(cpus().length - 1, 1),
//...
}; On my machine which is MBP 16'' 2019 with a 6-core Intel i7, |
Just want to report that we had to give up on PnP, unfortunately 😕. There is something quite strange going on between Next.js, webpack, Yarn PnP and who-knows-what. This is a cross-post from our internal issue: After avoiding the EPIPE error, builds started showing PnP errors like this:
I originally started dealing with those one by one – either installing it to our Optional peer dependencies, PnP and webpacknode-fetch has this in their compiled output: let convert;
try {
convert = require('encoding').convert;
} catch (e) {} That's a correct way to try to load an optional peerDependency, and plain Node.js + Yarn PnP don't have any problem with that: try creating a small project with const fetch = require('node-fetch');
console.log('done'); and run it with However, when run via webpack, this fails, so it's for further exploration in [internal issue]. BTW, by default, packageExtensions:
'node-fetch@2.6.0':
peerDependencies:
encoding: '*'
peerDependenciesMeta:
encoding:
optional: true Then it fails with a different error: I still think this isn't right – it's an optional peer dependency so it shouldn't be required to be provided by one of its ancestors. Loose mode as a workaroundAdded in [commit hash], Build now passes but generates a lot of warnings: These warnings can be silenced with Another strange thing is that trying to use webpack 4 produces very different output from webpack 5, about which I've posted #27045. All in all, Next.js 11 + Yarn PnP seems quite broken at this point. |
I've tried everything suggested here with no luck, and had to switch back to NPM for now 😞 |
I don't think this is limited to mac btw. I'm seeing this on Windows as well. |
We've started getting it in our pipeline builds which run on alpine |
Based on the discussion in [next.js!27000](vercel/next.js#27000), I enabled a limit of 3 CPUs for Next. Hopefully I'll be able to take this out.
This doesn't seem to work on the following either:
We get the crashes on
It will consistently crash running
For some reason, |
Is there anyone who can test my modified PR(#28420) ? |
This is still happening to me on next@11.1.2 node v16.2.0 and yarn 3.0.0. |
Yeah, me too, just less often |
Hi, please create a new issue with a repo with a minimal reproduction to allow further investigation! |
Much like the problem listed in this issue, it's intermittent and difficult to isolate, and it mostly happens randomly during high CPU load when doing a build. I can try to reproduce in a reliable way later but it seems to be pretty sporadic. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
11.0.1
What version of Node.js are you using?
16.4.2
What browser are you using?
Firefox
What operating system are you using?
macOs Big Sur 11.4 (MacBook Pro 15" 2017)
How are you deploying your application?
next build
Describe the Bug
I've decided to move my project on to next@11.0.1, using macOS for development.
When i try building it, i get the following lines:
At some point, the error was gone, but i cannot reproduce the steps necessary to completely fix the issue.
This issue is related to macOS and nextjs >11 versions only as this error doesn't pop up on other machines/versions.
Related: This project uses the
pnp
packaging system fromyarn version berry
Expected Behavior
The project should build.
To Reproduce
Calling
next build
on macOS with next@11The text was updated successfully, but these errors were encountered: