Build failing on Mac 'stdout maxBuffer length exceeded'

When I run cordova build ios --verbose I get the following error:

.......
This app does not have additional resource files defined
Prepared iOS project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
stdout maxBuffer length exceeded
RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded
    at Socket.onChildStdout (child_process.js:354:14)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:265:13)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:94:17)

Any idea what could be the cause? I removed the platforms directory already… I think it is happening since I upgraded XCode to 11.4 a couple of days ago.

I tested a new app, it is showing the same error

Ionic:

   Ionic CLI                     : 6.4.0 (/Users/***/.nvm/versions/node/v10.16.3/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 4.11.2
   @angular-devkit/build-angular : 0.803.12
   @angular-devkit/schematics    : 8.3.12
   @angular/cli                  : 8.3.12
   @ionic/angular-toolkit        : 2.1.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 16 other plugins)

Utility:

   cordova-res (update available: 0.11.0) : 0.8.1
   native-run (update available: 0.3.0)   : 0.2.9

System:

   Android SDK Tools : 26.1.1 (/Users/***/Library/Android/sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.2
   NodeJS            : v10.16.3 (/Users/***/.nvm/versions/node/v10.16.3/bin/node)
   npm               : 6.14.3
   OS                : macOS Catalina
   Xcode             : Xcode 11.4 Build version 11E146

Does it also happen without verbose?

I found out that node v10.16.3 and node v10.19.0 have this issue. When upgrading to node v12.16.1 it works without a problem.

The default maxBuffer size in v10 is 200KB, the default maxBuffer in v12 is 1MB.
https://nodejs.org/docs/latest-v10.x/api/child_process.html
https://nodejs.org/docs/latest-v12.x/api/child_process.html

4 Likes

I have the some problem with an old Ionic v1 project (it started to happen when I upgraded XCode to version 12) - but, in my case, I can’t upgrade Node to version 12 because Ionic v1 projects use gulp v3 and it doesn’t work with Node 12 (just Node 10). I’m still trying to find a solution.

Solution found: I had to update “@ionic/v1-toolkit” in my Ionic v1 project, so I could update Gulp to version 4 and Node to version 12 (the only issue is that the old “gulpfile.js” is not compatible with Gulp 4, so it needs to be updated as well).

Could you please help us with the same issue.