Ionic2 build fail: TypeError: Cannot read property 'text' of undefined


#1

Hi,

Getting a build failure when trying to build an ionic2 app for android.

$> ionic build android
[11:15:16]  ionic-app-scripts 0.0.45
[11:15:16]  build prod started ...
[11:15:16]  clean started ...
[11:15:16]  clean finished in 4 ms
[11:15:16]  copy started ...
[11:15:16]  ngc started ...
[11:15:17]  copy finished in 286 ms

[11:15:38]  TypeError: Cannot read property 'text' of undefined
[11:15:38]  ngc failed
[11:15:38]  ionic-app-script task: "build"
[11:15:38]  Error: Error

#2

Hi I had the same problem a few days back.
I’ve tried a few changes and it worked finally but I’m not sure which solved the problems.

I guess it happened after updating ionic-cli.
If so, you can try upgrading to the latest ionic-app-scripts also. You need to do some changes on the config files.

Another thing I did is simply removing all the caret symbols in package.json
I don’t know if this could help, but I read this somewhere.


#3

Do you have any object with a property “text” in a view?


#4

I had the same error during ngc.
It was due to upgrading typescript from 2.0.6 to the latest 2.1.4.
Since downgrading back to 2.0.6 it builds fine.


#5

thanks guys for your feedback.

@GBoyle, looks like that was it. Thanks for the help!


#6

I had the same error.

sudo npm install @ionic/app-scripts@latest --save-dev

after

has own your app /src/app/main.ts

main.dev.ts and main.prod.ts are depreciated

my package.json
"devDependencies": {
"@ionic/app-scripts": “^1.0.0”,
“typescript”: “2.1.4”
},