Pitayan / gatsby-theme-pitayan

A minimal blog theme plugin for Gatsby
https://pitayan.github.io/gatsby-theme-pitayan/
MIT License
30 stars 11 forks source link

Netlify UNHANDLED EXCEPTION write EPIP #17

Closed daiyanze closed 2 years ago

daiyanze commented 2 years ago

Description There's an write PIPE error during the deployment on Netlify.

7:58:03 PM: error UNHANDLED EXCEPTION write EPIPE
7:58:03 PM: 
7:58:03 PM: 
7:58:03 PM:   Error: write EPIPE
7:58:03 PM:   
7:58:03 PM:   - child_process.js:841 ChildProcess.target._send
7:58:03 PM:     internal/child_process.js:841:20
7:58:03 PM:   
7:58:03 PM:   - child_process.js:712 ChildProcess.target.send
7:58:03 PM:     internal/child_process.js:712:19
7:58:03 PM:   
7:58:03 PM:   - index.js:298 WorkerPool.sendMessage
7:58:03 PM:     [repo]/[gatsby-worker]/dist/index.js:298:19
7:58:03 PM:   
7:58:03 PM:   - worker-messaging.ts:22 
7:58:03 PM:     [repo]/[gatsby]/src/utils/jobs/worker-messaging.ts:22:22
7:58:03 PM:   
7:58:03 PM: 
7:58:03 PM: not finished Merge worker state - 0.030s
7:58:03 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
7:58:03 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduction Link Omit

Steps to Reproduce Deploy with Netlify

Expected Result No error happened on Netlify

Actual Result Error & Deploy failed

Environment System: OS: macOS 11.6.1 CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz Memory: 410.50 MB / 16.00 GB Shell: 5.8 - /bin/zsh Languages: Bash: 3.2.57 - /bin/bash Go: 1.16.5 - /Users/yanze.dai/.goenv/shims/go Java: javac 17 - /usr/local/opt/openjdk/bin/javac Perl: 5.30.2 - /usr/bin/perl PHP: 7.3.29 - /usr/bin/php Python: 2.7.16 - /usr/bin/python Python3: 3.9.12 - /usr/local/bin/python3 Ruby: 2.6.3 - /usr/bin/ruby Rust: 1.54.0 - /Users/yanze.dai/.cargo/bin/rustc Browsers: Brave Browser: 99.1.36.111 Chrome: 100.0.4896.127 Edge: 100.0.1185.50 Firefox: 98.0 Safari: 15.1 Safari Technology Preview: 15.4

daiyanze commented 2 years ago

Found related links:

https://github.com/gatsbyjs/gatsby/issues/35055 https://github.com/gatsbyjs/gatsby/issues/33738 https://answers.netlify.com/t/gatsby-v4-works-locally-but-timed-out-on-netlify/46339/29

The reason why this happened is that Gatsby > 4.7.0 uses more memory for concurrent build. Netlify only provides 3GB of memory (sometimes 6GB) for the deployment.

The possible solutions have been provided by the community supporter.

  1. Try using Gatsby <= 4.7
  2. Try disabling AVIF and WEBP in gatsby.config.js
  3. Try reducing the size of the source images
  4. If nothing works, deploy via CLI

Downgrading to 4.7.0 should work for most of the cases. Also choose yarn over npm for the deployment on Netlify

daiyanze commented 2 years ago

This can be resolved by upgrading the Gatsby package to version > 4.13.1.

https://github.com/gatsbyjs/gatsby/issues/33738#issuecomment-1113291501