Ionic-app-scripts: Internal error when doing production build

Created on 25 Oct 2016  路  9Comments  路  Source: ionic-team/ionic-app-scripts

I am using latest app-scripts (@beta). Doing ionic serve, ionic-app-scripts build --dev works fine. Trying to do ionic-app-scripts build fails with below error. How can I debug this?

[00:11:39] ionic-app-scripts 0.0.37
[00:11:39] build prod started ...
[00:11:39] clean started ...
[00:11:39] clean finished in 6 ms
[00:11:39] copy started ...
[00:11:39] ngc started ...
[00:11:40] lint started ...
[00:11:40] copy finished in 386 ms
[00:11:49] Error: Internal error: unknown identifier [object Object]
[00:11:49] ngc failed
[00:11:49] ionic-app-script task: "build"
[00:11:49] Error: Error

Your system information:

Cordova CLI: 6.3.1
Gulp version:  CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
Ionic App Scripts Version: 0.0.37
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: Mac OS X Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.0 Build version 8A218a
blocked

Most helpful comment

Sorry people. Commenting this line in my app.module.ts the problem has gone:
{provide: Window, useValue: window},

Sorry again.

All 9 comments

Hello, thanks for using Ionic! Unfortunately I am not able to reproduce this issue, would you mind posting a repo we can use to reproduce it?

Unfortunately this is on a private repo. Any way I can have a more verbose error output?

EDIT: Running ngc directly I get

Error: Internal error: unknown identifier [object Object]
    at _TsEmitterVisitor._visitIdentifier (/my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:15522:21)
    at _TsEmitterVisitor.visitExternalExpr (/my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:15312:16)
    at ExternalExpr.visitExpression (/my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:1869:26)
    at _TsEmitterVisitor.AbstractEmitterVisitor.visitWritePropExpr (/my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:14999:22)
    at WritePropExpr.visitExpression (/my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:1791:26)
    at _TsEmitterVisitor.AbstractEmitterVisitor.visitExpressionStmt (/my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:14918:21)
    at ExpressionStatement.visitStatement (/my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:2069:26)
    at /my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:15199:60
    at Array.forEach (native)
    at _TsEmitterVisitor.AbstractEmitterVisitor.visitAllStatements (/my-path/node_modules/@angular/compiler/bundles/compiler.umd.js:15199:22)
Compilation failed

It is my understanding that is probably to angular compiler rather than these tools, is that correct?

Edit2: Looking through issues on ngc repo I stumbled upon a similar error that was caused by a non standard provider declaration. Apparently my error is caused when trying to assign global PouchDB instance to an angular DI entry like: { provide: PouchDB, useValue: PouchDB }

@masimakopoulos You are correct, this is an internal NGC error and not an error coming from our app-scripts. Could you try deleting your node_modules and reinstalling? Thanks!

Could I also use the latest version of angular-compiler as the ones used in the sample ionic2 package.json seem a bit outdated

    "@angular/compiler": "2.0.0",
    "@angular/compiler-cli": "0.6.2",

vs

    "@angular/compiler": "2.1.1",
    "@angular/compiler-cli": "2.1.1",

maybe I get lucky and there is more info or bug fix on the newer versions. Will that cause trouble with app-scripts?

Just referencing the ngc related issue https://github.com/angular/angular/issues/11034 for future reference

Hey @masimakopoulos , good question, so i actually opened this pr to update us to the latest NGC and Angular. For now if you try to update your app to the latest NGC its gonna break stuff, but that PR will fix this. I am going to mark this one as blocked for now because of this.

@masimakopoulos,

Angular had a change in ngc that is breaking semver and compatibility with Ionic. Can you update your package.json to 2.0.0 and get rid of the ^, then do a fresh npm install. This should fix the issue I think.

I'll re-open if needed. I think this will fix it. We're working on supporting the most recent version of Angular ASAP.

Thanks,
Dan

Hi people. I have a simillar issue:

Error: Internal error: unknown identifier {}
    at _TsEmitterVisitor._resolveStaticSymbol (/path/node_modules/@angular/compiler/bundles/compiler.umd.js:18517:19)
    at _TsEmitterVisitor._visitIdentifier (/path/node_modules/@angular/compiler/bundles/compiler.umd.js:18535:23)
    at _TsEmitterVisitor.visitExternalExpr (/path/node_modules/@angular/compiler/bundles/compiler.umd.js:18197:14)
    at ExternalExpr.visitExpression (/path/node_modules/@angular/compiler/bundles/compiler.umd.js:15390:24)
    at _TsEmitterVisitor.AbstractEmitterVisitor.visitBinaryOperatorExpr (/path/node_modules/@angular/compiler/bundles/compiler.umd.js:17888:17)
    at BinaryOperatorExpr.visitExpression (/path/node_modules/@angular/compiler/bundles/compiler.umd.js:15534:24)
    at _TsEmitterVisitor.AbstractEmitterVisitor.visitIfStmt (/path/node_modules/@angular/compiler/bundles/compiler.umd.js:17575:24)
    at IfStmt.visitStatement (/path/node_modules/@angular/compiler/bundles/compiler.umd.js:15957:24)
    at /path/node_modules/@angular/compiler/bundles/compiler.umd.js:17998:58
    at Array.forEach (native)
Compilation failed

Ionic info:

global packages:

    @ionic/cli-utils : 1.5.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.5.0

local packages:

    @ionic/app-scripts              : 1.3.6
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : android 6.1.2
    Ionic Framework                 : ionic-angular 3.1.1

System:

    Node       : v6.10.3
    OS         : Linux 4.4
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.0.4 

I already delete my node_modules folder and re install all, but the problem persists. Can anyone help me please?

Sorry people. Commenting this line in my app.module.ts the problem has gone:
{provide: Window, useValue: window},

Sorry again.

Was this page helpful?
0 / 5 - 0 ratings