# Build dev failed: Cannot read property 'indexOf' of undefined

**URL:** <https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506>\
**Category:** ionic-v3\
**Created:** [November 28, 2016, 1:47am UTC](https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506 "2016-11-28T01:47:00Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![nilton\_felicio](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/nilton_felicio/32/100637_2.png) [@nilton\_felicio](https://forum.ionicframework.com/u/nilton_felicio)\
**Post date:** [December 22, 2016, 12:21pm UTC](https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506/21 "2016-12-22T12:21:36Z")

</div>

For me it works perfectly. Follow the steps and be sure to update the app-script to 0.48.

npm install firebase angularfire2 --save = \> NO  
npm install angularfire2 --save =\> YES.  
Do not install firebase. Only install AngularFire2, not documented but Firebase is inside AngularFire2. Also when using firebase, you no longer need:  
import firebase from firebase -\>Do not do it.

My project goes this way without making any mistakes on the console. I hope I have helped.

---

<div class="post-metadata">

**Author:** ![jcguarinpenaranda](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@jcguarinpenaranda](https://forum.ionicframework.com/u/jcguarinpenaranda)\
**Post date:** [January 11, 2017, 6:48pm UTC](https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506/22 "2017-01-11T18:48:13Z")

</div>

Hello, I had your problem this morning and I didn’t know what to do.

I figured out I was using the library @types/es6-shim to get some typings for Promises and other es6 stuff in other libraries of my own that I later imported to my project. When I imported these libraries I developed to my project I started getting the error.

Then I saw I had installed typescript as a dependency and I saw it uses the library lib.es2015.d.ts which conflicts with @types/es6-shim. I discovered this by building to android. When I did this I got a lot of errors in the console telling me there were duplicates in some typings.

The way I fixed it was removing @types/es6-shim from my node\_modules folder and then removing the triple slash references from my modules (so they would use lib.es2015 and not @types/es6-shim.

I hope this helps

---

<div class="post-metadata">

**Author:** ![Maxi\_wb](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Maxi\_wb](https://forum.ionicframework.com/u/Maxi_wb)\
**Post date:** [January 25, 2017, 8:38am UTC](https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506/23 "2017-01-25T08:38:21Z")

</div>

Exactly the same problem here (we have no firebase or angularfire2 installed on the project but it fails with that “‘indexOf’ of undefined” error).  
Did you finally fix it up?

---

<div class="post-metadata">

**Author:** ![Nereus](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/nereus/32/105574_2.png) [@Nereus](https://forum.ionicframework.com/u/Nereus)\
**Post date:** [January 25, 2017, 10:44am UTC](https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506/24 "2017-01-25T10:44:10Z")

</div>

> [@Maxi\_wb](#):
>
> Did you finally fix it

Which version of app-scripts do you have?  
Had the same error without Angularfire2 on a old version of the appscript.  
Another post about it

> <https://github.com/ionic-team/ionic-app-scripts/issues/340>
>
> \#### Short description of the problem:
> \`ionic serve\` fails:
> 
> \`\`\`
> biesbjerg-m…acbook-pro:rc-wip kim$ ionic serve
> \[22:42:00\] build dev failed: Cannot read property 'length' of undefined
> 
> \> mindly-app@ ionic:serve /Users/kim/ionic/mindly-app/rc-wip
> \> ionic-app-scripts serve "\[object Object\]"
> 
> \[22:42:02\] ionic-app-scripts 0.0.42
> \[22:42:03\] watch started ...
> \[22:42:03\] build dev started ...
> \[22:42:03\] clean started ...
> \[22:42:03\] clean finished in less than 1 ms
> \[22:42:03\] copy started ...
> \[22:42:03\] transpile started ...
> \[22:42:04\] build dev failed: Cannot read property 'length' of undefined
> \[22:42:07\] build dev failed: Cannot read property 'length' of undefined
> \[22:42:07\] copy finished in 4.44 s
> \[22:42:07\] watch ready in 4.48 s
> \[22:42:07\] dev server running: http://localhost:8100/
> \`\`\`
> 
> \*\*Steps to reproduce:\*\*
> 1. Follow \[upgrade steps\](https://github.com/driftyco/ionic-app-scripts/blob/335bd51f34624b0a87a980fe0400912e82f3b560/CHANGELOG.md) to 0.0.42
> 2. run \`ionic serve\`
> 
> \*\*Which @ionic/app-scripts version are you using?\*\*
> 0.0.42
> 
> \*\*\`ionic info\`:\*\*
> \`\`\`
> Your system information:
> 
> Cordova CLI: 6.4.0
> Ionic Framework Version: 2.0.0-rc.2
> Ionic CLI Version: 2.1.7
> Ionic App Lib Version: 2.1.4
> Ionic App Scripts Version: 0.0.42
> ios-deploy version: 1.9.0
> ios-sim version: 5.0.11
> OS: macOS Sierra
> Node Version: v6.9.1
> Xcode version: Xcode 8.1 Build version 8B62
> \`\`\`
> 
> \*\*Complete \`package.json\`:\*\*
> \`\`\`
> {
> "name": "mindly-app",
> "author": "Kim Biesbjerg@Info Products",
> "homepage": "http://infoproducts.dk/",
> "private": true,
> "scripts": {
> "ionic:build": "ionic-app-scripts build",
> "ionic:serve": "ionic-app-scripts serve"
> },
> "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",
> "@ngrx/core": "^1.2.0",
> "@ngrx/effects": "^2.0.0",
> "@ngrx/store": "^2.2.1",
> "angular2-uuid": "^1.1.0",
> "ionic-angular": "2.0.0-rc.2",
> "ionic-native": "^2.2.3",
> "ionicons": "3.0.0",
> "ngrx-store-freeze": "^0.1.4",
> "ngrx-store-logger": "^0.1.5",
> "rxjs": "5.0.0-beta.12",
> "zone.js": "0.6.21"
> },
> "devDependencies": {
> "@ionic/app-scripts": "\>=0.0.39",
> "@types/cordova-plugin-media": "0.0.3",
> "typescript": "^2.0.6"
> },
> "cordovaPlugins": \[
> "cordova-plugin-file",
> "cordova-plugin-compat",
> {
> "locator": "https://github.com/EddyVerbruggen/cordova-plugin-backgroundaudio",
> "id": "nl.x-services.plugins.backgroundaudio"
> },
> {
> "locator": "https://github.com/biesbjerg/cordova-plugin-inapppurchase.git",
> "id": "cordova-plugin-inapppurchase"
> },
> "cordova-plugin-device",
> "cordova-plugin-console",
> "cordova-plugin-whitelist",
> "cordova-plugin-splashscreen",
> "cordova-plugin-statusbar",
> "ionic-plugin-keyboard",
> "cordova-plugin-globalization",
> "cordova-plugin-media",
> "cordova-plugin-x-socialsharing",
> "cordova-plugin-google-analytics",
> "cordova-sqlite-storage",
> "cordova-plugin-app-version"
> \],
> "cordovaPlatforms": \[
> "ios",
> {
> "platform": "ios",
> "version": "",
> "locator": "ios"
> },
> {
> "platform": "android",
> "version": "",
> "locator": "android"
> }
> \],
> "description": "This app guarantees that your audio books from Mindly are always within reach."
> }
> \`\`\`
> 
> EDIT: Ping @danbucholtz ;-)

---

<div class="post-metadata">

**Author:** ![Maxi\_wb](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Maxi\_wb](https://forum.ionicframework.com/u/Maxi_wb)\
**Post date:** [January 25, 2017, 1:09pm UTC](https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506/25 "2017-01-25T13:09:38Z")

</div>

I had 0.0.47 but after changing it to 1.0.0 it seems to work Ok.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Nereus](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/nereus/32/105574_2.png) [@Nereus](https://forum.ionicframework.com/u/Nereus)\
**Post date:** [January 25, 2017, 1:10pm UTC](https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506/26 "2017-01-25T13:10:10Z")

</div>

np dude 🙂

[Previous page](https://forum.ionicframework.com/t/build-dev-failed-cannot-read-property-indexof-of-undefined/71506.md?page=1)
