# Errors when trying to build my project

**URL:** <https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564>\
**Category:** ionic-v3\
**Created:** [August 19, 2017, 7:32pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564 "2017-08-19T19:32:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monster555](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Monster555](https://forum.ionicframework.com/u/Monster555)\
**Post date:** [August 19, 2017, 7:32pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/1 "2017-08-19T19:32:05Z")

</div>

Hello…  
I’m having lots of issues when trying to build any of my projects using “ionic cordova build android” or "ionic cordova build android --prod"  
With the first command I get the error Execution failed for task ‘:packageDebug’. \> !zip.isFile()  
With the second one I get the error FATAL ERROR: CALL\_AND\_RETRY\_LAST Allocation failed - JavaScript heap out of memory  
Several days ago this two commands were working perfectly but now I’m unable to build any of my projects. Using “ionic serve -l” they work perfect but I need to build my release package.  
Any suggestions???  
Thanx…

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 19, 2017, 10:23pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/2 "2017-08-19T22:23:42Z")

</div>

Post your complete `ionic info` output please.

Also post the complete output you get running these two commands, add `--verbose` when running them.

---

<div class="post-metadata">

**Author:** ![Monster555](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Monster555](https://forum.ionicframework.com/u/Monster555)\
**Post date:** [August 19, 2017, 10:43pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/3 "2017-08-19T22:43:19Z")

</div>

My ionic info  
cli packages: (D:\Ionic\WooIonic\node\_modules)

```
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2

```

global packages:

```
Cordova CLI : 7.0.1

```

local packages:

```
@ionic/app-scripts : 1.3.7
Cordova Platforms : android 6.2.3 browser 4.1.0
Ionic Framework : ionic-angular 3.4.2

```

System:

```
Node : v6.11.0
npm : 3.10.10
OS : Windows 10

```

Using the --verbose flag…

```auto
PS D:\Ionic\WooIonic> ionic cordova build android --verbose
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: 'D:\\Ionic\\WooIonic', local: true, binPath:
        'C:\\Users\\MDC\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath:
        'D:\\Ionic\\WooIonic\\node_modules\\ionic\\dist\\index.js' }
[DEBUG] Daemon found (pid: 12144)
[WARN] Detected @ionic/cli-plugin-cordova in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:

       npm uninstall --save-dev --save-exact @ionic/cli-plugin-cordova

[WARN] Detected @ionic/cli-plugin-ionic-angular in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:

       npm uninstall --save-dev --save-exact @ionic/cli-plugin-ionic-angular

[INFO] Running app-scripts build: --platform android --target cordova

[17:40:48] build dev started ...
[17:40:48] clean started ...
[17:40:48] clean finished in 16 ms
[17:40:48] copy started ...
[17:40:48] transpile started ...
[17:40:50] transpile finished in 2.31 s
[17:40:50] preprocess started ...
[17:40:50] deeplinks started ...
[17:40:51] deeplinks finished in 100 ms
[17:40:51] preprocess finished in 100 ms
[17:40:51] webpack started ...
[17:40:51] copy finished in 2.61 s
[17:41:16] webpack finished in 25.52 s
[17:41:16] sass started ...
[17:41:17] sass finished in 855 ms
[17:41:17] postprocess started ...
[17:41:17] removed unused font files
[17:41:17] postprocess finished in 15 ms
[17:41:17] lint started ...
[17:41:17] build dev finished in 28.88 s
> ionic cordova prepare
> cordova prepare
\ Running command [17:41:20] tslint: D:/Ionic/WooIonic/src/pages/cart/cart.ts, line: 99
            Unused variable: 'price'

      L98: // this.cartItems.
      L99: let price = item.product.price;
     L100: let qty = item.qty;

[17:41:20] tslint: D:/Ionic/WooIonic/src/pages/cart/cart.ts, line: 100
            Unused variable: 'qty'

      L99: let price = item.product.price;
     L100: let qty = item.qty;
     L101: this.total = 0.0;

[17:41:20] tslint: D:/Ionic/WooIonic/src/pages/cart/cart.ts, line: 117
| Running command Unused variable: 'price'

     L116: decreaseCartValue(item, i){
     L117: let price = item.product.price;
     L118: let qty = item.qty;

[17:41:20] tslint: D:/Ionic/WooIonic/src/pages/cart/cart.ts, line: 118
            Unused variable: 'qty'

     L117: let price = item.product.price;
     L118: let qty = item.qty;
     L119: this.total = 0.0;

[17:41:20] tslint: D:/Ionic/WooIonic/src/pages/menu/menu.ts, line: 2
            Unused import: 'Content'

       L1: import { Component, ViewChild } from '@angular/core';
       L2: import { Content, IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
       L3: //import { HomePage } from '../home/home';

[17:41:20] tslint: D:/Ionic/WooIonic/src/app/app.component.ts, line: 8
            Unused import: 'Menu'

       L8: import { Menu } from '../pages/menu/menu';
       L9: //import { Signup } from '../pages/signup/signup';

[17:41:20] tslint: D:/Ionic/WooIonic/src/pages/categories/categories.ts, line: 1
            Unused import: 'ViewChild'

       L1: import { Component, ViewChild } from '@angular/core';
       L2: import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';

[17:41:20] tslint: D:/Ionic/WooIonic/src/pages/home/home.ts, line: 8
            Unused import: 'AccordionComponent'

       L7: import { Global } from '../../global';
       L8: import { AccordionComponent } from '../../components/accordion/accordion';

[17:41:20] tslint: D:/Ionic/WooIonic/src/pages/order-details/order-details.ts, line: 3
            Unused import: 'Global'

       L2: import { IonicPage, NavController, NavParams } from 'ionic-angular';
       L3: import { Global } from '../../global';

[17:41:20] tslint: D:/Ionic/WooIonic/src/pages/product-details/product-details.ts, line: 11
            Unused import: 'AccordionComponent'

      L10: import { PhotoViewer } from '@ionic-native/photo-viewer';
      L11: import { AccordionComponent } from '../../components/accordion/accordion';

[17:41:20] lint finished in 2.64 s
√ Running command - done!

> cordova build android
× Running command - failed!
[ERROR] An error occurred while running cordova build android (exit code 1):

        (truncated) ... ovaLib:processDebugResources UP-TO-DATE
        :CordovaLib:generateDebugSources UP-TO-DATE
        :CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
        :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
        :CordovaLib:processDebugJavaRes UP-TO-DATE
        :CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
        :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
        :CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
        :CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
        :CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
        :CordovaLib:bundleDebug UP-TO-DATE
        :CordovaLib:preReleaseBuild UP-TO-DATE
        :CordovaLib:checkReleaseManifest
        :CordovaLib:prepareReleaseDependencies
        :CordovaLib:compileReleaseAidl UP-TO-DATE
        :CordovaLib:compileReleaseNdk UP-TO-DATE
        :CordovaLib:copyReleaseLint UP-TO-DATE
        :CordovaLib:mergeReleaseShaders UP-TO-DATE
        :CordovaLib:compileReleaseShaders UP-TO-DATE
        :CordovaLib:generateReleaseAssets UP-TO-DATE
        :CordovaLib:mergeReleaseAssets UP-TO-DATE
        :CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
        :CordovaLib:packageReleaseRenderscript UP-TO-DATE
        :CordovaLib:compileReleaseRenderscript UP-TO-DATE
        :CordovaLib:generateReleaseResValues UP-TO-DATE
        :CordovaLib:generateReleaseResources UP-TO-DATE
        :CordovaLib:packageReleaseResources UP-TO-DATE
        :CordovaLib:processReleaseManifest UP-TO-DATE
        :CordovaLib:generateReleaseBuildConfig UP-TO-DATE
        :CordovaLib:processReleaseResources UP-TO-DATE
        :CordovaLib:generateReleaseSources UP-TO-DATE
        :CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
        :CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
        :CordovaLib:processReleaseJavaRes UP-TO-DATE
        :CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
        :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
        :CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
        :CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
        :CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
        :CordovaLib:bundleRelease UP-TO-DATE
        :prepareComAndroidSupportAnimatedVectorDrawable2531Library UP-TO-DATE
        :prepareComAndroidSupportAppcompatV72531Library UP-TO-DATE
        :prepareComAndroidSupportCardviewV72531Library UP-TO-DATE
        :prepareComAndroidSupportCustomtabs2531Library UP-TO-DATE
        :prepareComAndroidSupportSupportCompat2531Library UP-TO-DATE
        :prepareComAndroidSupportSupportCoreUi2531Library UP-TO-DATE
        :prepareComAndroidSupportSupportCoreUtils2531Library UP-TO-DATE
        :prepareComAndroidSupportSupportFragment2531Library UP-TO-DATE
        :prepareComAndroidSupportSupportMediaCompat2531Library UP-TO-DATE
        :prepareComAndroidSupportSupportV42531Library UP-TO-DATE
        :prepareComAndroidSupportSupportVectorDrawable2531Library UP-TO-DATE
        :prepareComCommit451PhotoView124Library UP-TO-DATE
        :prepareComFacebookAndroidFacebookAndroidSdk4250Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesBase1104Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesBasement1104Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesGcm1104Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesIid1104Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesLocation1104Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesTasks1104Library UP-TO-DATE
        :prepareComOnesignalOneSignal357Library UP-TO-DATE
        :prepareComPaypalSdkPaypalAndroidSdk2153Library UP-TO-DATE
        :prepareIoCardAndroidSdk540Library UP-TO-DATE
        :prepareOrgApacheCordovaCordovaLib623DebugLibrary UP-TO-DATE
        :prepareDebugDependencies
        :compileDebugAidl UP-TO-DATE
        :compileDebugRenderscript UP-TO-DATE
        :generateDebugBuildConfig UP-TO-DATE
        :generateDebugResValues UP-TO-DATE
        :generateDebugResources UP-TO-DATE
        :mergeDebugResources UP-TO-DATE
        :processDebugManifest UP-TO-DATE
        :processDebugResources UP-TO-DATE
        :generateDebugSources UP-TO-DATE
        :incrementalDebugJavaCompilationSafeguard UP-TO-DATE
        :compileDebugJavaWithJavac UP-TO-DATE
        :compileDebugNdk UP-TO-DATE
        :compileDebugSources UP-TO-DATE
        :mergeDebugShaders UP-TO-DATE
        :compileDebugShaders UP-TO-DATE
        :generateDebugAssets UP-TO-DATE
        :mergeDebugAssets UP-TO-DATE
        :transformClassesWithDexForDebug UP-TO-DATE
        :mergeDebugJniLibFolders UP-TO-DATE
        :transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
        :processDebugJavaRes UP-TO-DATE
        :transformResourcesWithMergeJavaResForDebug UP-TO-DATE
        :validateSigningDebug
        :packageDebug FAILED

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':packageDebug'.
        > !zip.isFile()

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

        BUILD FAILED

        Total time: 12.993 secs
        Error: cmd: Command failed with exit code 1 Error output:
        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':packageDebug'.
        > !zip.isFile()

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

```

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 19, 2017, 10:53pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/4 "2017-08-19T22:53:48Z")

</div>

> [@Monster555](#):
>
> Execution failed for task ‘:packageDebug’.  
> \> !zip.isFile()

Most often these can be fixed by opening the Android project in Android Studio and then clean the project. Maybe even `cordova clean android` is enough: [CLI Commands - Apache Cordova](https://cordova.apache.org/docs/en/latest/reference/cordova-cli/#cordova-clean-command)

---

<div class="post-metadata">

**Author:** ![Monster555](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Monster555](https://forum.ionicframework.com/u/Monster555)\
**Post date:** [August 19, 2017, 11:12pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/5 "2017-08-19T23:12:02Z")

</div>

That seems to work… And what about the error when using

> [@](#):
>
> ionic cordova build android --prod

Getting FATAL ERROR: CALL\_AND\_RETRY\_LAST Allocation failed - JavaScript heap out of memory???

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 19, 2017, 11:15pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/6 "2017-08-19T23:15:42Z")

</div>

Run with `--verbose` added at the end, post the complete output.

---

<div class="post-metadata">

**Author:** ![Monster555](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Monster555](https://forum.ionicframework.com/u/Monster555)\
**Post date:** [August 19, 2017, 11:23pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/7 "2017-08-19T23:23:51Z")

</div>

The --verbose output with --prod flag

```auto

[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: 'D:\\Ionic\\WooIonic', local: true, binPath:
        'C:\\Users\\MDC\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath:
        'D:\\Ionic\\WooIonic\\node_modules\\ionic\\dist\\index.js' }
[DEBUG] Daemon found (pid: 12144)
[WARN] Detected @ionic/cli-plugin-cordova in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:

       npm uninstall --save-dev --save-exact @ionic/cli-plugin-cordova

[WARN] Detected @ionic/cli-plugin-ionic-angular in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:

       npm uninstall --save-dev --save-exact @ionic/cli-plugin-ionic-angular

[INFO] Running app-scripts build: --prod --platform android --target cordova

[18:20:49] build prod started ...
[18:20:49] clean started ...
[18:20:49] clean finished in less than 1 ms
[18:20:49] copy started ...
[18:20:49] ngc started ...
[18:20:57] ngc finished in 8.25 s
[18:20:57] preprocess started ...
[18:20:57] deeplinks started ...
[18:20:58] deeplinks finished in 672 ms
[18:20:58] optimization started ...
[18:20:58] copy finished in 9.19 s
[18:21:14] optimization finished in 15.87 s
[18:21:14] preprocess finished in 16.55 s
[18:21:14] webpack started ...

<--- Last few GCs --->

   97270 ms: Mark-sweep 1081.6 (1436.4) -> 1081.6 (1436.4) MB, 808.7 / 0.0 ms [allocation failure] [GC in old space requested].
   98082 ms: Mark-sweep 1081.6 (1436.4) -> 1081.6 (1436.4) MB, 811.7 / 0.0 ms [allocation failure] [GC in old space requested].
   98959 ms: Mark-sweep 1081.6 (1436.4) -> 1098.0 (1418.4) MB, 877.2 / 0.0 ms [last resort gc].
   99777 ms: Mark-sweep 1098.0 (1418.4) -> 1114.7 (1418.4) MB, 817.1 / 0.0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 000003D0305CFB49 <JS Object>
    1: addMapping(aka SourceMapGenerator_addMapping) [D:\Ionic\WooIonic\node_modules\source-map\lib\source-map-generator.js:~94] [pc=000003DFCF0B65CB] (this=00000214117BD8B9 <a SourceMapGenerator with map 00000242968F37B9>,aArgs=000001DD4DCEEA71 <an Object with map 00000242968F34A1>)
    2: /* anonymous */ [D:\Ionic\WooIonic\node_modules\source-map\lib\source-node.js:345] [pc=000003DFCF0968C9...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

```

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 19, 2017, 11:29pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/8 "2017-08-19T23:29:35Z")

</div>

Webpack seems to require too much space to finish. No idea what to do about it though, sorry.

---

<div class="post-metadata">

**Author:** ![Monster555](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Monster555](https://forum.ionicframework.com/u/Monster555)\
**Post date:** [August 19, 2017, 11:31pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/9 "2017-08-19T23:31:43Z")

</div>

Thanks anyway… I have 8GB of RAM and, as I told you before, I’m getting this error since a few days. Before that everything was OK. I’ll keep trying to fix this.  
Again… Thank you very much!!!

---

<div class="post-metadata">

**Author:** ![Monster555](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Monster555](https://forum.ionicframework.com/u/Monster555)\
**Post date:** [August 25, 2017, 4:45pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/10 "2017-08-25T16:45:15Z")

</div>

I made some changes to ionic.cmd file. Now it looks like this…

@IF EXIST “%~dp0\node.exe” (  
"%~dp0\node.exe --max\_old\_space\_size=10240" “%~dp0\node\_modules\ionic\bin\ionic” %\*  
) ELSE (  
@SETLOCAL  
@SET PATHEXT=%PATHEXT:;.JS;=;%  
node --max\_old\_space\_size=10240 “%~dp0\node\_modules\ionic\bin\ionic” %\*  
)  
And it seems to be solved the problem so far.

---

<div class="post-metadata">

**Author:** ![wcustodio](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wcustodio](https://forum.ionicframework.com/u/wcustodio)\
**Post date:** [September 15, 2017, 1:17pm UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/11 "2017-09-15T13:17:36Z")

</div>

`cordova clean android` worked for me. Thanks!

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [September 28, 2017, 9:44am UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/12 "2017-09-28T09:44:47Z")

</div>

Thx your @wcustodio I faced the same error (after having updated my android libs and restarted my mac) and running the clean cmd solved my issue ❤

---

<div class="post-metadata">

**Author:** ![adityajaiz](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@adityajaiz](https://forum.ionicframework.com/u/adityajaiz)\
**Post date:** [October 15, 2017, 8:58am UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/13 "2017-10-15T08:58:49Z")

</div>

This really helped, Thanks a Ton!  
`cordova clean android`

---

<div class="post-metadata">

**Author:** ![mihirp1730](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@mihirp1730](https://forum.ionicframework.com/u/mihirp1730)\
**Post date:** [November 22, 2017, 11:24am UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/14 "2017-11-22T11:24:34Z")

</div>

Thanks man,  
Works for me.  
thanks for sharing.

---

<div class="post-metadata">

**Author:** ![stmukesh](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@stmukesh](https://forum.ionicframework.com/u/stmukesh)\
**Post date:** [October 18, 2019, 5:36am UTC](https://forum.ionicframework.com/t/errors-when-trying-to-build-my-project/102564/15 "2019-10-18T05:36:25Z")

</div>

thanks dear , also worked for me.
