Ionic-app-scripts: Failed to transpile program error with ionic cordova build

Created on 26 Aug 2017  路  40Comments  路  Source: ionic-team/ionic-app-scripts

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

Error: Failed to transpile program
Got the above error when I run ionic cordova build ios

Steps to reproduce:

  1. ionic cordova build ios
// tsconfig.json
{
    "compilerOptions": {
        "allowSyntheticDefaultImports": true,
        "declaration": false,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "lib": [
            "dom",
            "es2015"
        ],
        "module": "es2015",
        "moduleResolution": "node",
        "sourceMap": true,
        "target": "es5",
        "types": [
            "node"
        ]
    },
    "include": [
        "src/**/*.ts"
    ],
    "exclude": [
      "./node_modules",
        "src/test.ts",
        "src/**/*.spec.ts"
    ],
    "compileOnSave": false,
    "atom": {
        "rewriteTsconfig": false
    }
}

Which @ionic/app-scripts version are you using?
app-scripts 2.1.4

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

Most helpful comment

Actually... 3 words. ionic doctor check <3 Saved my butt at least

All 40 comments

any update ? i got same issue for android build. https://forum.ionicframework.com/t/error-failed-to-transpile-program/103408

Also i have tried updating ionic (Ionic CLI) : 3.9.2 and remove node_modules and npm install, removed platform and add again.... but nothing working.

+1

+1

+1

+1

+1

If you created a new provider and there was an error in the provider class (ex. a missing bracket)
This was in my case.

I updated and got this error as well. Was working perfectly before

+1

+1

Actually... 3 words. ionic doctor check <3 Saved my butt at least

@PivitParkour94 Thank you, you save my day

@pmvcaqr Glad I could help man! My issue was having the default bundle ID in the config.xml still. Would be cool if the error message was somewhat obvious. Oh well. Maybe one day ;)

I ran $ Ionic doctor check, fixed the issues and now there are 0 issues. But I still get this error in the Build Log on Ionic Dashboard:

Error: Failed to transpile program
    at new BuildError (/usr/src/app/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at /usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:159:20
    at Promise ()
    at transpileWorker (/usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)
    at Object.transpile (/usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)
    at /usr/src/app/node_modules/@ionic/app-scripts/dist/build.js:109:82
    at 
npm info lifecycle [email protected]~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `ionic-app-scripts build`
npm ERR! Exit status 1

+1

I ran $ Ionic doctor check, fixed the issues and now there are 0 issues. But I still get this error in the Build Log on Ionic Dashboard:

Error: Failed to transpile program
at new BuildError (/usr/src/app/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
at /usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:159:20
at Promise ()
at transpileWorker (/usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)
at Object.transpile (/usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)
at /usr/src/app/node_modules/@ionic/app-scripts/dist/build.js:109:82
at
npm info lifecycle [email protected]~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: ionic-app-scripts build
npm ERR! Exit status 1

Samething here...

Error: Failed to transpile program
at new BuildError (/usr/src/app/node_modules//dist/util/errors.js:16:28)
at /usr/src/app/node_modules//dist/transpile.js:159:20
at Promise ()
at transpileWorker (/usr/src/app/node_modules//dist/transpile.js:107:12)
at Object.transpile (/usr/src/app/node_modules//dist/transpile.js:64:12)
at /usr/src/app/node_modules//dist/build.js:109:82
at
npm info lifecycle [email protected]~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: ionic-app-scripts build
npm ERR! Exit status 1

Same error as above

same issue

same issue for me...

Error: Failed to transpile program at new BuildError (//node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at //node_modules/@ionic/app-scripts/dist/transpile.js:159:20 at new Promise (<anonymous>) at transpileWorker (//node_modules/@ionic/app-scripts/dist/transpile.js:107:12) at Object.transpile (//node_modules/@ionic/app-scripts/dist/transpile.js:64:12) at //node_modules/@ionic/app-scripts/dist/build.js:109:82 at <anonymous>

[DEBUG] Error: Failed to transpile program at new BuildError //node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at //node_modules/@ionic/app-scripts/dist/transpile.js:159:20 at new Promise (<anonymous>) at transpileWorker //node_modules/@ionic/app-scripts/dist/transpile.js:107:12) at Object.transpile //node_modules/@ionic/app-scripts/dist/transpile.js:64:12) at //node_modules/@ionic/app-scripts/dist/build.js:109:82 at <anonymous>

No one?

same issue

It just happened to me.

Error: Failed to transpile program at new BuildError (/Users/jhonatasrosendo/dev/blue_mobile_app/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at /Users/jhonatasrosendo/dev/blue_mobile_app/node_modules/@ionic/app-scripts/dist/transpile.js:159:20 at new Promise (<anonymous>) at transpileWorker (/Users/jhonatasrosendo/dev/blue_mobile_app/node_modules/@ionic/app-scripts/dist/transpile.js:107:12) at Object.transpile (/Users/jhonatasrosendo/dev/blue_mobile_app/node_modules/@ionic/app-scripts/dist/transpile.js:64:12) at /Users/jhonatasrosendo/dev/blue_mobile_app/node_modules/@ionic/app-scripts/dist/build.js:109:82 at <anonymous>

`ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.2
Node              : v8.10.0
npm               : 5.6.0
OS                : macOS High Sierra
Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

ANDROID_HOME : /Users/jhonatasrosendo/Library/Android/sdk

Misc:

backend : legacy`

Same here. If I try:

ionic cordova prepare

I get:

typescript: src/components/push-notification/push-notification.ts, line: 61

and:

 Error: Failed to transpile program
    at BuildError.Error (native)

Or:

   [13:28:25]  transpile started ... 

   [13:28:34]  typescript: node_modules/rxjs/Subject.d.ts, line: 16 
        Class 'Subject<T>' incorrectly extends base class 'Observable<T>'. Types of property 'lift' are 
        incompatible. Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: 
        Operator<T, R>) => Observable<R>'. Type 'Observable<T>' is not assignable to type 'Observable<R>'. Type 'T' 
        is not assignable to type 'R'.

The ionic info:

ionic info
[WARN] Detected locally installed Ionic CLI, but it's too old--using global CLI.

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.3.0 browser 5.0.3 ios 4.5.4
    Ionic Framework    : ionic-angular 3.6.0

System:

    ios-deploy : 1.9.2 
    Node       : v6.5.0
    npm        : 3.10.3 
    OS         : macOS High Sierra
    Xcode      : Xcode 9.2 Build version 9C40b 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

If I run:

ionic doctor check

It fixed some issues, but also left me with:

Fixed 2 issues!
3 issues need to be fixed manually.

I assume some of those manual issues include:

   A major update is available for Ionic Native (3.12.1 => 4.6.0). To fix, take the following step(s):

        1) Visit https://github.com/ionic-team/ionic-native/releases, looking for breaking changes
        2) Update each @ionic-native/ package. For example, npm i --save -E @ionic-native/[email protected]
        3) Update your app according to the breaking changes, if any

   Ignore this issue with: ionic doctor ignore ionic-native-major-update-available

Among the issues raised by Doctor, that I should handle manually, is this:

    There are Cordova platforms installed that are not saved in config.xml or package.json. It is good practice to  manage Cordova platforms and their versions. See 
   https://cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/ for more information. To fix, the 
   following step(s) need to be taken:

        1) Run: ionic cordova platform save

If I do this:

  ionic cordova platform save

I get :

> cordova platform save
This command has been deprecated and will be removed in the next major release of cordova.

I am getting this error as well. Here's my ionic info

cli packages: (/root/jenkins/workspace/Smartpatient/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.1.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v9.10.1
    npm  : 5.6.0
    OS   : Linux 2.6

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

This works just fine on my local mac machine. However, when I try to run this on CentOS server, that's when I see the error.
Any help on this would be highly appreciated.

Fixed this by installing yarn then inside the project folder I ran yarn which is like npm install but somehow better (https://www.sitepoint.com/yarn-vs-npm/)

Fixed this with find and remove any imports from the
@angular/compiler-cli

+1

Same error. Nothing described above works for me.

+1

+1

+1

hi everyone
I downgrade my angular version to 5.0.0 and fixed that. I thing typescript have conflicts version with angular 6+.

my versions.

Angular CLI: 1.5.6
Node: 6.11.1
OS: darwin x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

@angular-devkit/architect: 0.6.8
@angular-devkit/build-angular: 0.6.8
@angular-devkit/build-optimizer: 0.6.8
@angular-devkit/core: 0.6.8
@ngtools/webpack: 6.0.8
typescript: 2.9.2
webpack: 4.17.1

This didn't help me, I'm already running 5.3.1..

Same here, still having a problem

@harveyelsisura.

I was able to fix it on my end. What does your --verbose say?

+1 This is driving me nuts

+1

Issue Fixed By following
After adding platform use following command --> cordova clean

Changing my typescript version to 2.9.2 seems to have solved my problem.

+1

Same issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkErik picture MarkErik  路  3Comments

isflo96 picture isflo96  路  3Comments

janpio picture janpio  路  3Comments

brandyscarney picture brandyscarney  路  4Comments

NoNameProvided picture NoNameProvided  路  4Comments