ionic-team/ionic-cli

ionic build: Error in subprocess stdout pipe: Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd

marcelgoya opened this issue · 7 comments

Description:
I'm getting the following error when I run ionic build --prod

Output:

ionic build --prod --verbose
  ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
  ionic:cli-utils CLI global options: { _: [ 'build' ], help: false, h: false, verbose: true, quiet: false, interactive: true, color: true, confirm: false, json: false, prod: true, project: null, '--': [] } +268ms
  ionic:cli-utils:lib:environment Environment open. +0ms
  ionic:cli-utils:lib:project Project type from config: ionic/angular 4 (angular) +0ms
  ionic:cli-utils Project name: undefined +11ms
  ionic:cli Context: { binPath: '/usr/lib/node_modules/ionic/bin/ionic', libPath: '/usr/lib/node_modules/ionic', execPath: '/mnt/c/Users/marce/Documents/Code/xCode/lingusocial-ionic-v4', version: '4.0.0-rc.11' } +0ms
  ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:cli-utils:lib:project:angular:build Looking for ionic:build npm script. +0ms
> ng run app:build:production

Date: 2018-07-22T10:20:52.876Z
Hash: f05c78487b891411c436
Time: 13139ms
chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
chunk {1} styles.0dd73f3f0a0fd9c590d8.css (styles) 15.1 kB [initial] [rendered]
chunk {2} polyfills.207dcc605630215505f5.js (polyfills) 130 bytes [initial] [rendered]
chunk {3} main.f58b96bf9bf614ca37d4.js (main) 128 bytes [initial] [rendered]
  ionic:cli-utils:lib:shell Error in subprocess stdout pipe: Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd (_stream_writable.js:241:12) at Object.Writable.write (_stream_writable.js:291:5) at Readable.write (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:855:33) at DestroyableTransform.ondata (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:619:20) at DestroyableTransform.emit (events.js:180:13) at addChunk (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:291:12) at readableAddChunk (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:278:11) at DestroyableTransform.Readable.push (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:245:10) at DestroyableTransform.Transform.push (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_transform.js:148:32) at push (/usr/lib/node_modules/ionic/node_modules/split2/index.js:52:10) +0ms
  ionic:cli-utils:lib:shell Error in subprocess stderr pipe: Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd (_stream_writable.js:241:12) at Object.Writable.write (_stream_writable.js:291:5) at Readable.write (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:855:33) at DestroyableTransform.ondata (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:619:20) at DestroyableTransform.emit (events.js:180:13) at addChunk (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:291:12) at readableAddChunk (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:278:11) at DestroyableTransform.Readable.push (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:245:10) at DestroyableTransform.Transform.push (/usr/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_transform.js:148:32) at push (/usr/lib/node_modules/ionic/node_modules/split2/index.js:52:10) +1ms
[ERROR] An error occurred while running subprocess ng.

        ng run app:build:production exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: running 1 queued functions +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +1ms

My ionic info:


Ionic:

   ionic (Ionic CLI)          : 4.0.0-rc.11 (/usr/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-alpha.11
   @angular-devkit/core       : 0.7.0-rc.2
   @angular-devkit/schematics : 0.7.0-rc.2
   @angular/cli               : 6.0.8
   @ionic/ng-toolkit          : 1.0.0-rc.11
   @ionic/schematics-angular  : 1.0.0-rc.11

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : none

System:

   NodeJS : v9.11.2 (/usr/bin/node)
   npm    : 6.2.0
   OS     : Linux 4.4

Environment:

   ANDROID_HOME : not set

Other Information:

@marcelgoya What is the output of just running npx ng run app:build:production?

Hi, problem solved. I had some errors inside my html templates and running the cmd above displayed them for me. Everything is now working as expected. Thanks!

@marcelgoya Mind if I keep this open? It's a bug if the Ionic CLI doesn't print the error from the Angular CLI. It's odd though, I can't seem to reproduce this issue.

~/apps/angular/brand-new master*
❯ ionic build --prod
> ng run app:build:production

Date: 2018-07-23T20:54:09.264Z
Hash: 0579dd002d3bb06a9bfd
Time: 5541ms
chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
chunk {1} styles.65cdfd787c8c5f149080.css (styles) 15.1 kB [initial] [rendered]
chunk {2} polyfills.207dcc605630215505f5.js (polyfills) 130 bytes [initial] [rendered]
chunk {3} main.f58b96bf9bf614ca37d4.js (main) 128 bytes [initial] [rendered]

ERROR in : Template parse errors:
Unexpected closing tag "ion-header". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("
    </ion-title>
  <!-- </ion-toolbar> -->
[ERROR ->]</ion-header>

<ion-content padding>
"): /.../angular/brand-new/src/app/pages/home/home.page.html@6:0

[ERROR] An error occurred while running subprocess ng.

        ng run app:build:production exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

Can I ask if the error you received was particularly lengthy (thousands of characters)?

@dwieeb Sure, feel free. Strange, I didn't see any console output.

@marcelgoya Was the error you received particularly lengthy (thousands of characters)?

No, it only said that it couldn't compile but it didn't output any specific details

Have the similar problem on macOS 10.14 when running ionic cordova run android --verbose --no-interactive command.

2018-10-18T10:07:46.629Z ionic:lib:shell Error in subprocess stdout pipe: Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd (_stream_writable.js:243:12) at Object.Writable.write (_stream_writable.js:291:5) at Readable.write (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:855:33) at DestroyableTransform.ondata (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:619:20) at DestroyableTransform.emit (events.js:182:13) at addChunk (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:291:12) at readableAddChunk (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:278:11) at DestroyableTransform.Readable.push (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:245:10) at DestroyableTransform.Transform.push (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_transform.js:148:32) at push (/usr/local/lib/node_modules/ionic/node_modules/split2/index.js:52:10)
2018-10-18T10:07:46.629Z ionic:lib:shell Error in subprocess stderr pipe: Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd (_stream_writable.js:243:12) at Object.Writable.write (_stream_writable.js:291:5) at Readable.write (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:855:33) at DestroyableTransform.ondata (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:619:20) at DestroyableTransform.emit (events.js:182:13) at addChunk (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:291:12) at readableAddChunk (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:278:11) at DestroyableTransform.Readable.push (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_readable.js:245:10) at DestroyableTransform.Transform.push (/usr/local/lib/node_modules/ionic/node_modules/readable-stream/lib/_stream_transform.js:148:32) at push (/usr/local/lib/node_modules/ionic/node_modules/split2/index.js:52:10)

ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.2.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.13
   @angular-devkit/build-angular : 0.8.5
   @angular-devkit/schematics    : 0.8.5
   @angular/cli                  : 6.2.5
   @ionic/angular-toolkit        : 1.0.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.1
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 4 other plugins)

System:

   NodeJS : v10.12.0 (/usr/local/Cellar/node/10.12.0/bin/node)
   npm    : 6.4.1
   OS     : macOS
   Xcode  : Xcode 10.0 Build version 10A255