Ionic-cli: error "build dev failed: Cannot read property 'indexOf' of undefined"

Created on 23 Nov 2016  路  9Comments  路  Source: ionic-team/ionic-cli

Hi,
i have this error :
"build dev failed: Cannot read property 'indexOf' of undefined "

when i use "ionic serve"

but if i run "ionic build browser", everything is ok.

I've removed all my node_modules and do a fresh "npm install".
I've deleted the ".tmp" & "www" dir too, but the error still displaying.

Please can you help me ? Thanks you,
best regards

This is my ionic info :
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.9.0
ios-sim version: 5.0.11
OS: OS X El Capitan
Node Version: v6.7.0
Xcode version: Xcode 8.1 Build version 8B62

and my package.json :
{
"name": "H2EAU_Mesures",
"author": "Benjamin MARCHAND - Key-conseil.fr",
"homepage": "http://techique.h2eauassistance.com",
"private": true,
"scripts": {
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"config": {
"ionic_bundler": "webpack"
},
"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/cloud-angular": "^0.7.0",
"@ionic/storage": "1.1.6",
"@types/lodash": "4.14.38",
"angular2-google-maps": "0.16.0",
"angular2-jwt": "0.1.25",
"angular2-uuid": "1.1.0",
"intl": "^1.2.5",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"lodash": "4.17.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "0.0.45",
"typescript": "2.0.6"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard",
"uk.co.workingedge.phonegap.plugin.launchnavigator"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "H2EAU Mesures"
}

old major version

Most helpful comment

Delete the firebase.d.ts in the folder node_modulesfirebase\
馃馃

All 9 comments

Same Problem Here i use Firebase

Same problem for using Firebase.

I have the same issue as well but I don't have Firebase. I have those extra libraries instead:

"ejson": "2.1.2",
"headroom.js": "0.9.3",
"imgcache.js": "1.0.0",
"leaflet": "1.0.2",
"leaflet-control-geocoder": "^1.5.4",
"localforage": "^1.4.3",
"moment": "2.15.1",
"ng2-translate": "4.0.0",
"photoswipe": "4.1.1",
"underscore": "1.8.3",

I also upgrade to app-script 0.0.47, the issue still there.

I am also using firebase and just started getting this yesterday. Anyone figure it out yet?

No idea if this is related but I have a service with a contstructor like so:

constructor(@Inject(FirebaseApp) app: firebase.app.App)

On my windows box I get the 'indexOf' of undefined error, but on my Mac i get 'Expression form not supported' in that service for the firebase in firebase.app.App. Just curious if any of you are using the @Inject in a similar manner anywhere that could be causing this.

Delete the firebase.d.ts in the folder node_modulesfirebase\
馃馃

Running into the same issue:
build dev failed: Cannot read property 'indexOf' of undefined

{
"name": "ionic-hello-world",
"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.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic/storage": "1.1.6",
"firebase": "^3.6.6",
"ionic-angular": "2.0.0-rc.4",
"ionic-native": "2.2.11",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "0.0.47",
"typescript": "2.0.9"
},
"description": "OutdoorNinja1",
"cordovaPlugins": [],
"cordovaPlatforms": []
}

node version : 6.9.1
ionic app script : 0.0.47
I deleted node_modules and did npm cache clean and then npm install --save again but I'm still hitting the issue. Any thoughts?

@janand4 tries to change your ionic app script version:

"devDependencies": {
"@ionic/app-scripts": "1.0.0" // "0.0.47"
"typescript": "2.0.9"
},

I think that this is version last. I had the same problem.

Good luck! ;)

FYI, using @ionic/app-scripts: 1.0.0 and firebase: ^3.6.7 I don't receive the error any longer. (Also using angularfire2: 2.0.0-beta.7 for anyone using that as well). Update your dependencies, delete node_modules folder and npm install

Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings