Error: Failed to transpile program ionic2

I’ve been developing an app for 6 months now. I’ve never tested it on a device, always in browser, but it’s gotten to the point where I want to test on my android phone.

So I do ionic cordova run android --device and I get an error:

Error: Failed to transpile program at BuildError.Error (native) at new BuildError (C:\xampp\htdocs\project x\projectx\node_modules@ionic\app-scripts\dist\util\errors.js:16:28) at C:\xampp\htdocs\project x\projectx\node_modules@ionic\app-scripts\dist\transpile.js:159:20 at transpileWorker (C:\xampp\htdocs\project x\projectx\node_modules@ionic\app-scripts\dist\transpile.js:107:12) at Object.transpile (C:\xampp\htdocs\project x\projectx\node_modules@ionic\app-scripts\dist\transpile.js:64:12) at C:\xampp\htdocs\project x\projectx\node_modules@ionic\app-scripts\dist\build.js:109:82 [18:05:02] copy finished in 4.95 s

which I can’t seem to fix.

I was curious if it was perhaps a problem with my machine, or phone, or something so I created a new ionic project by doing ionic start ionic-test and then simply running it again with ionic cordova run android --device, and this time it worked perfectly. It ran on my device.

So considering that, can I simply paste over my src files into the new project? or is there something else I can do to get this working? Any ideas/tips? Thanks!

Edit:

Here is a pastebin to the entire result of ionic cordova run android --device.
$ ionic cordova run android --deviceRunning app-scripts build: --platform andr - Pastebin.com (note: there were about 200 code warnings from typescript but they were all very minor stuff)

And here is a pastebin for ionic info

Start by working towards a build that has no TypeScript warnings.

You need to post a copy of your package.json

1 Like

Here is my package.json

{
  "name": "projectx",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "5.0.3",
    "@angular/compiler": "5.0.3",
    "@angular/compiler-cli": "5.0.3",
    "@angular/core": "5.0.3",
    "@angular/forms": "5.0.3",
    "@angular/http": "5.0.3",
    "@angular/platform-browser": "5.0.3",
    "@angular/platform-browser-dynamic": "5.0.3",
    "@ionic-native/base64-to-gallery": "^4.7.0",
    "@ionic-native/core": "4.4.0",
    "@ionic-native/geolocation": "^4.5.3",
    "@ionic-native/splash-screen": "4.4.0",
    "@ionic-native/status-bar": "4.4.0",
    "@ionic/pro": "1.0.19",
    "@ionic/storage": "^2.1.3",
    "angularfire2": "^5.0.0-rc.6",
    "cordova-android": "^7.0.0",
    "cordova-plugin-canvas2image": "git+https://github.com/devgeeks/Canvas2ImagePlugin.git",
    "cordova-plugin-device": "^2.0.1",
    "cordova-plugin-geolocation": "^4.0.1",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.1.16",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlite-storage": "^2.2.1",
    "firebase": "^4.10.0",
    "geofire": "^4.1.2",
    "ionic-angular": "3.9.2",
    "ionic-app-lib": "^2.2.1",
    "ionicons": "3.0.0",
    "jquery": "^3.3.1",
    "lodash": "^4.17.5",
    "path": "^0.12.7",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "time-ago-pipe": "^1.2.1",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.8",
    "typescript": "2.4.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To connect you"
      }
    },
    "platforms": [
      "android"
    ]
  }
}

Why are you using JQuery?

I was testing something. I think I only have a handful of jQuery lines… I can do without it.

Hi @SimonKomlos, @robinyo

Few days now Since I am stuck with this issue
has no exported members functions
as mentioned below

[13:43:38] typescript: …mpp/htdocs/project x/projectx/node_modules/angularfire2/firebase.app.module.d.ts, line: 2
Module ‘“C:/xampp/htdocs/project x/projectx/node_modules/firebase/index”’ has no exported member
‘functions’.

L1: import { InjectionToken } from ‘@angular/core’;
L2: import { app, auth, database, firestore, functions, messaging, storage } from ‘firebase/app’;
L3: export declare type FirebaseOptions = {

Right now I am unable to build my app
Is there a solution ?

Thank you for your time

package.json
{
“name”: “TryMe”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},
“dependencies”: {
@angular/animations”: “5.2.10”,
@angular/common”: “5.2.10”,
@angular/compiler”: “5.2.10”,
@angular/compiler-cli”: “5.2.10”,
@angular/core”: “5.2.10”,
@angular/forms”: “5.2.10”,
@angular/http”: “5.2.10”,
@angular/platform-browser”: “5.2.10”,
@angular/platform-browser-dynamic”: “5.2.10”,
@ionic-native/camera”: “^4.7.0”,
@ionic-native/core”: “4.7.0”,
@ionic-native/firebase”: “^4.7.0”,
@ionic-native/splash-screen”: “4.7.0”,
@ionic-native/status-bar”: “4.7.0”,
@ionic/pro”: “1.0.20”,
@ionic/storage”: “2.1.3”,
“angularfire2”: “^5.0.0-rc.4”,
“cordova-android”: “7.0.0”,
“cordova-plugin-camera”: “^4.0.3”,
“cordova-plugin-device”: “^2.0.2”,
“cordova-plugin-ionic-keyboard”: “^2.0.5”,
“cordova-plugin-ionic-webview”: “^1.1.19”,
“cordova-plugin-splashscreen”: “^5.0.2”,
“cordova-plugin-whitelist”: “^1.3.3”,
“firebase”: “^4.8.0”,
“ionic-angular”: “3.9.2”,
“ionicons”: “3.0.0”,
“rxjs”: “5.5.10”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.26”
},
“devDependencies”: {
@ionic/app-scripts”: “3.1.9”,
“typescript”: “~2.6.2”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-plugin-whitelist”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-camera”: {},
“cordova-plugin-ionic-webview”: {},
“cordova-plugin-ionic-keyboard”: {}
},
“platforms”: [
“android”
]
}
}

ionic info

cli packages: (/home/maximus/.npm-global/lib/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.9
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.11.2
npm               : 5.6.0 
OS                : Linux 4.13

Environment Variables:

ANDROID_HOME : /home/maximus/Android/Sdk

Misc:

backend : pro

No I’m still having the same issue…