ionic-cli: ionic cordova resources crashing (ERR_STREAM_DESTROYED)

Description:

When trying to generate the appropriate resources to build a project, ionic cordova resources does crash in the generation process.

Steps to Reproduce:

Call ionic cordova resources inside an Ionic 4 project.

Output:

ionic cordova resources                                                                                                                                                                      
✔ Collecting resource configuration and source images - done!
✔ Filtering out image resources that do not need regeneration - done!
✔ Uploading source images to prepare for transformations: 2 / 2 complete - done!
✖ Generating platform resources: 3 / 25 complete - failed!
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed

    at doWrite (_stream_writable.js:406:19)
    at clearBuffer (_stream_writable.js:540:7)
    at onwrite (_stream_writable.js:465:7)
    at fs.write (fs.js:2284:5)
    at FSReqWrap.wrapper [as oncomplete] (fs.js:645:5)
⠏ Generating platform resources: 7 / 25 complete

My ionic info:

Ionic:

   ionic (Ionic CLI)          : 4.0.0-rc.11 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-alpha.11
   @angular-devkit/core       : 0.7.0-rc.1
   @angular-devkit/schematics : 0.7.0-rc.1
   @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     : android 7.0.0 ios 4.5.4

System:

   NodeJS : v10.4.1 (/usr/local/bin/node)
   npm    : 6.2.0
   OS     : macOS High Sierra
   Xcode  : Xcode 9.4.1 Build version 9F2000

Environment:

   ANDROID_HOME : not set

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (7 by maintainers)

Most upvoted comments

Had the same issue with v4.0.1 but when I ran npm i -g ionic@4.1.0-testing.458303e0 and it worked flawlessly.

Thank you all for testing the 4.1.0-testing.458303e0 version. 💪 The fix will be in 4.0.2 when this gets merged: https://github.com/ionic-team/ionic-cli/pull/3429

Out of curiosity, could someone try this CLI version and let me know if the error still occurs: npm i -g ionic@4.1.0-testing.458303e0

@dwieeb I’m not behind a proxy.

I updated the CLI to v4.0.1 but it’s still showing the same errors.

Here’s the icon:

icon

I was still having this issue with ionic cli 4.12.0,

ionic cordova resources android --force
√ Collecting resource configuration and source images - done!
√ Filtering out image resources that do not need regeneration - done!
| Uploading source images to prepare for transformations
HTTP Error 503: POST https://res.ionic.io/api/v1/upload

<!DOCTYPE html>
        <html>
          <head>
                <meta name="viewport" content="width=device-width, initial-scale=1">
                <meta charset="utf-8">
                <title>Application Error</title>
                <style media="screen">
                  html,body,iframe {
                        margin: 0;
                        padding: 0;
                  }
                  html,body {
                        height: 100%;
                        overflow: hidden;
                  }
                  iframe {
                        width: 100%;
                        height: 100%;
                        border: 0;
                  }
                </style>
          </head>
          <body>
                <iframe src="//www.herokucdn.com/error-pages/application-error.html"></iframe>
          </body>

so I used this NPM Cordova-Res package to generate resources

hey @dwieeb !

You’re right, the error I mentioned was gone when I tried to generate the resources the first time!

Unfortunately the process didn’t complete and hang up with 5 out of 25 generated.

ionic cordova resources
✔ Collecting resource configuration and source images - done!
✔ Filtering out image resources that do not need regeneration - done!
✔ Uploading source images to prepare for transformations: 2 / 2 complete - done!
⠼ Generating platform resources: 5 / 25 complete

I re-ran the command and now I get the same error again.

ionic cordova resources
✔ Collecting resource configuration and source images - done!
✔ Filtering out image resources that do not need regeneration - done!
✔ Uploading source images to prepare for transformations: 2 / 2 complete - done!
✖ Generating platform resources: 1 / 25 complete - failed!
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed

    at doWrite (_stream_writable.js:406:19)
    at clearBuffer (_stream_writable.js:540:7)
    at onwrite (_stream_writable.js:465:7)
    at fs.write (fs.js:2284:5)
    at FSReqWrap.wrapper [as oncomplete] (fs.js:645:5)
⠧ Generating platform resources: 4 / 25 complete

Sometimes the process get’s to 4 or 5 generated or even 10, but it never made it to generating all 25 files.

edit: I just downgraded to CLI v3.20 and ran ionic cordova resources and this generated everything without problems!