Cannot read property 'kind' of undefined


#1

I’m trying to ionic run android and got this erorr.
I was able to ionic serve without problem though.

Running ‘run:before’ npm script before run

> RestaurantCollection@ build C:\Users\Kelok\Desktop\RestaurantCollection
> ionic-app-scripts build

[10:20:18]  ionic-app-scripts 0.0.43 
[10:20:18]  build prod started ...
[10:20:18]  clean started ...
[10:20:18]  clean finished in 4 ms
[10:20:18]  copy started ...
[10:20:18]  ngc started ...
[10:20:19]  copy finished in 331 ms
[10:20:26]  TypeError: Cannot read property 'kind' of undefined 
[10:20:26]  ngc failed 
[10:20:26]  ionic-app-script task: "build" 
[10:20:26]  Error: Error 

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "D:\\Programs\\Node.js\\node.exe" "C:\\Users\\Kelok\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.2.0
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! RestaurantCollection@ build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the RestaurantCollection@ build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the RestaurantCollection package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs RestaurantCollection
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls RestaurantCollection
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Kelok\Desktop\RestaurantCollection\npm-debug.log

My package.json:

{
  "name": "RestaurantCollection",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/compiler-cli": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/platform-server": "2.1.1",
    "@ionic/storage": "1.1.6",
    "ionic-angular": "2.0.0-rc.2",
    "angularfire2": "^2.0.0-beta.5",
    "firebase": "^3.5.0",
    "ionic-native": "^2.2.4",
    "ionic2-rating": "0.0.10",
    "ionicons": "^3.0.0",
    "rxjs": "^5.0.0-beta.12",
    "zone.js": "^0.6.21"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.43",
    "typescript": "2.0.6"
  },
  "description": "IonicV2: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

I’m not sure what happened


#2

that’s a little weird that it didn’t give you a stacktrace on where that kind of undefined is. I had an issue with my app a couple of days ago that worked fine, but once I tried to run on android, it would fail at the same step. I’m pretty sure it’s at the AoT stage and I had two different issues. first I had a function like so:

export const someFunction: referenceFunction<type> = (state: Object[] = []) => {}

which it hated and said something like “Consider replacing the function or lambda with a reference to an exported function” which I changed to:

export function someFunction (state: Object[] = []) {}

the last issue I had was a function that used a param that was optional, and when called the function like so (click)="someFunction()" it said that it hasn’t provided the correct params. that one was fixed by doing someFunction(param?: String) {}