Ionic-app-scripts: [0.0.42] build dev failed

Created on 9 Nov 2016  Â·  78Comments  Â·  Source: ionic-team/ionic-app-scripts

Short description of the problem:

ionic serve fails:

biesbjerg-macbook-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 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 ;-)

needs_reply

Most helpful comment

It seems like the indexOf null pointer is swallowing a legitimate error. I'll investigate and fix in the coming days.

Thanks,
Dan

All 78 comments

Hmm... Removing node_modules and doing a fresh npm install made it work.

Still says > ionic-app-scripts serve "[object Object]" on startup though, but ionic serve seems to work.

After updating to app-scripts 0.0.42 I also have build failed with ionic-serve, in my case:
build dev failed: Cannot find module '../util/Logger'

NOT fixed in my case by removing node_modules and doing a fresh npm install.

ionic-app-scripts serve "[object Object]"

[22:29:11] ionic-app-scripts 0.0.42
[22:29:12] watch started ...
[22:29:12] build dev started ...
[22:29:12] clean started ...
[22:29:12] clean finished in 22 ms
[22:29:12] copy started ...
[22:29:12] transpile started ...
[22:29:19] transpile finished in 6.71 s
[22:29:19] webpack started ...
[22:29:19] build dev failed: Cannot find module '../util/Logger'
[22:29:19] copy finished in 7.05 s
[22:29:19] watch ready in 7.17 s
[22:29:19] dev server running: http://localhost:8100/

ionic info

Your system information:

Cordova CLI: 6.3.1
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: Not installed
ios-sim version: Not installed
OS: Linux 3.8
Node Version: v6.8.0
Xcode version: Not installed

Hey @biesbjerg and @devnigelwheeler ! Thanks for posting an issue! Could you all post a repo that we can use to reproduce this issue?

@devnigelwheeler: Your issue is caused by https://github.com/driftyco/ionic-app-scripts/issues/326 since you're on Linux (I'm on MacOS)

@biesbjerg,

Are you able to recreate or was it just a one-time thing after you did the fresh npm install?

Thanks,
Dan

@danbucholtz Build works after fresh npm install.

The output ionic-app-scripts serve "[object Object]" looks weird, but does not affect the build process.

It affects the build.

"ionic serve --browser chrome" doesn't get passed to ionic-app-scripts.

This will go out today as part of 0.0.43. I'll close the issue when it does. The weird [Object object] thing will get fixed in a subsequent release as it's something in the CLI project.

Thanks,
Dan

This is resolved. Please install npm install @ionic/app-scripts@latest.

Thanks,
Dan

Happens on 0.0.43

There is an issue for this error at https://github.com/driftyco/ionic-app-scripts/issues/361

@danbucholtz

Happens on 0.0.45 as well. I get
ionic-app-scripts serve

[12:29:41] ionic-app-scripts 0.0.45
[12:29:41] watch started ...
[12:29:41] build dev started ...
[12:29:41] clean started ...
[12:29:41] clean finished in 3 ms
[12:29:41] copy started ...
[12:29:41] transpile started ...
[12:29:44] build dev failed: Cannot read property 'indexOf' of undefined
[12:29:44] copy finished in 3.15 s
[12:29:44] watch ready in 3.16 s
[12:29:44] dev server running: http://localhost:8100/

I have

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.2
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: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62

I have same issue as @ix-xerri

[12:20:44] ionic-app-scripts 0.0.45
[12:20:44] watch started ...
[12:20:44] build dev started ...
[12:20:44] clean started ...
[12:20:44] clean finished in 10 ms
[12:20:44] copy started ...
[12:20:44] transpile started ...
[12:20:53] build dev failed: Cannot read property 'indexOf' of undefined
[12:20:54] copy: Error copying
"/Users/hughred22/nodeapp/probook/Ionic2/Mybuild/firebaseDigitalWorkBook-rc2/src/manifest.json" to
"/Users/hughred22/nodeapp/probook/Ionic2/Mybuild/firebaseDigitalWorkBook-rc2/www/manifest.json": File not
found
[12:20:54] copy finished in 9.45 s
[12:20:54] watch ready in 9.49 s
[12:20:54] dev server running: http://localhost:8100/

Your system information:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v4.4.6
Xcode version: Xcode 7.3.1 Build version 7D1014

Just to share some insight. Look like this error is triggered b/c I have angularFire2 beta 0.6 installed. If I go back to angularFire2 beta 0.5, the error goes away. But I need angularFire2 beta 0.6 as there is major bug fixes in that version. I believe I have 0.6 before App Script update (from 0.0.36 to 0.0.45). No idea what is going wrong.

@ix-xerri, @hughred22,

What is the issue that you're seeing? Are you able to run ionic serve and see your app? Can you install the latest cli and try again? npm install -g ionic.

Please let me know how it goes and if there is an issue here.

Thanks,
Dan

ionic serve with blank page as the error mess up something.

@danbucholtz Sorry, just update to RC3 and angularFire beta 0.6, and the problem go away.

I updated ionic to RC3 and still get this error when doing ionic serve.

[04:47:01] ionic-app-scripts 0.0.44
[04:47:01] watch started ...
[04:47:01] build dev started ...
[04:47:01] clean started ...
[04:47:01] clean finished in 4 ms
[04:47:01] copy started ...
[04:47:01] transpile started ...
[04:47:06] build dev failed: Cannot read property 'indexOf' of undefined
[04:47:06] copy finished in 5.09 s
[04:47:06] watch ready in 5.11 s
[04:47:06] dev server running: http://localhost:8100/

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.44
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

@ix-xerri,

Have you customized the build at all? Is there anything unique about your set-up? I cannot recreate that.

Thanks,
Dan

No. I've setup pages and providers for the tabs template in ionic. But the build system has not been changed.

This is the line that breaks everything inside module : AngularFireModule.initializeApp(firebaseConfig)

If I console.log AngularFireModule all I get is:
function AngularFireModule() { }

i am having the same issue here

Same happening here, although I don't have AngularFire. I haven't modified the build in any form either.

Your system information:

Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.4.0

Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.0-beta.3
Ionic App Lib Version: 2.1.0-beta.1
OS: Distributor ID:     Ubuntu Description:     Ubuntu 14.04.3 LTS 
Node Version: v7.1.0

I just tried using the firebase library alone and it works. Can write to a database no problem and there are no errors.

I started seeing "build dev failed: Cannot read property 'indexOf' of undefined" after I ran these lines:

npm install typings --global
typings install debug --save
typings install dt~cordova --save --global
typings install dt~es6-shim --save --global

Before that I only had this error and ionic serve loaded just fine:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8100/build/main.css

@thomastthai,

We don't recommend using typings. You can use npm @types, which is what we support.

Thanks,
Dan

@vswarte,

What issue are you seeing? Can you see if you see the same issue with Node 6? We test on Node 4.x LTS and Node 6.x LTS.

Thanks,
Dan

$ ionic info

Your system information:

ordova 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.44
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed

Here are the errors from Chrome console:

http://localhost:8100/build/main.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8100/build/main.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://0.0.0.0:35729/livereload.js?snipver=1 Failed to load resource: net::ERR_ADDRESS_INVALID
http://localhost:8100/build/main.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8100/build/main.css Failed to load resource: the server responded with a status of 404 (Not Found)
util.js:210 Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keysRA.j @ util.js:210(anonymous function) @ js?sensor=false:126(anonymous function) @ js?sensor=false:46(anonymous function) @ js?sensor=false:43(anonymous function) @ js?sensor=false:46(anonymous function) @ js?sensor=false:98(anonymous function) @ js?sensor=false:43(anonymous function) @ js?sensor=false:98(anonymous function) @ js?sensor=false:43(anonymous function) @ js?sensor=false:98(anonymous function) @ js?sensor=false:43(anonymous function) @ js?sensor=false:98hc @ js?sensor=false:45gc.nb @ js?sensor=false:98(anonymous function) @ common.js:1
util.js:210 Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-requiredRA.j @ util.js:210(anonymous function) @ js?sensor=false:126(anonymous function) @ js?sensor=false:46(anonymous function) @ js?sensor=false:43(anonymous function) @ js?sensor=false:46(anonymous function) @ js?sensor=false:98(anonymous function) @ js?sensor=false:43(anonymous function) @ js?sensor=false:98(anonymous function) @ js?sensor=false:43(anonymous function) @ js?sensor=false:98(anonymous function) @ js?sensor=false:43(anonymous function) @ js?sensor=false:98hc @ js?sensor=false:45gc.nb @ js?sensor=false:98(anonymous function) @ common.js:1
ion-dev.js?v=0.0.44:112 Dev server logger closed

That was after I removed these:

npm remove typings --global
typings remove debug --save
typings remove dt~cordova --save --global
typings remove dt~es6-shim --save --global

I've also deleted node-modules && npm cache clean && npm install again. I still can't get back to getting ionic serve working again like it was before.

I had the same problem with a fresh install. I deleted my node_modules, cleared my npm cache, upgraded nodejs to the latest version, npm install and everything worked.

It's important you have the latest NodeJS.

I am currently running node v6.9.1 so its the latest lts. Are you on v7? Can you post your ionic info and package.json?

Package.json:

{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"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",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "2.2.3",
"ionicons": "3.0.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-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "Nufitness: An Ionic project"
}

Ionic info:

Cordova CLI: 6.0.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed

The build is not being complete because of AngularFire. It doesn't seem to be installed on your system. My system works if I don't install angular fire and use the default firebase library.

The build is now working. I was advised to use firebase 3.3.0 by @Chris1308 in this issue

I have this problem too, don't know what happened?
at first I was run #ionic serve with no problem
then I want to test on my android device so I run #ionic run android
and the error is come.
and try again with #ionic serve and the error still occur like below.

build dev failed: Cannot read property 'indexOf' of undefined

Your system information:

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: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v6.9.1
Xcode version: Not installed

$ ionic serve

ionic-app-scripts serve

[16:14:51] ionic-app-scripts 0.0.45
[16:14:51] watch started ...
[16:14:51] build dev started ...
[16:14:51] clean started ...
[16:14:51] clean finished in 15 ms
[16:14:51] copy started ...
[16:14:51] transpile started ...
[16:14:54] build dev failed: Cannot read property 'indexOf' of undefined
[16:14:54] copy finished in 2.91 s
[16:14:54] watch ready in 2.96 s
[16:14:54] dev server running: http://localhost:8100/

////////////////////////////////////////////////////////////////
I can run my app now.
the problem is I don't know what happened in file "declaration.d.ts" in src/
that change from
declare module '';
to
./declare module '
';

so I just simply change from "./declare module '';" to "declare module '';" and it work.
I have finally can run #ionic serve and #ionic run android with no problem now.

Please make sure you have firebase 3.3.0 installed. If not clear cache by npm cache clear and check package.json that is specifies that version.

@ix-xerri,

This isn't specifically a firebase issue more than likely.

@phutsa, yes that would definitely cause issues!

Thanks,
Dan

I'm getting the same error, and a blank white screen..

21:32:09] ionic-app-scripts 0.0.46
[21:32:09] watch started ...
[21:32:09] build dev started ...
[21:32:09] clean started ...
[21:32:09] clean finished in 6 ms
[21:32:09] copy started ...
[21:32:09] transpile started ...
[21:32:15] build dev failed: Cannot read property 'indexOf' of undefined

and $ ionic info...

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: OS X El Capitan
Node Version: v7.1.0
Xcode version: Xcode 8.0 Build version 8A218a

Thanks!

Try using node 6.9.1. That's the one I'm using

Hi, thanks for your help. I downgraded to 6.9.1 and am still receiving the same message..

Running 'serve:before' npm script before serve

ionic-hello-world@ watch /Users/admin/Desktop/myApp
ionic-app-scripts watch

[11:34:55] ionic-app-scripts 0.0.46
[11:34:55] watch started ...
[11:34:55] build dev started ...
[11:34:55] clean started ...
[11:34:55] clean finished in 42 ms
[11:34:55] copy started ...
[11:34:55] transpile started ...
[11:35:08] build dev failed: Cannot read property 'indexOf' of undefined
[11:35:09] copy: Error copying "/Users/admin/Desktop/myApp/node_modules/ionicons/dist/fonts" to
"/Users/admin/Desktop/myApp/www/assets/fonts"

[11:35:09] copy finished in 13.89 s
[11:35:09] watch ready in 13.98 s
Running live reload server: http://localhost:35729

Thanks again for any help.

This is my package.json and ionic info and everything works. Try to match the version number and see.

Package.json

{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"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/app-scripts": "0.0.44",
"@ionic/storage": "1.1.6",
"@ngrx/core": "^1.2.0",
"@ngrx/store": "^2.2.1",
"angularfire2": "^2.0.0-beta.6",
"firebase": "3.3.0",
"ionic-angular": "2.0.0-rc.2",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "0.0.42",
"@types/request": "0.0.30",
"typescript": "2.0.6"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "An Ionic project"
}

Ionic Info

Your system information:

Cordova CLI: 6.4.0
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
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

Hi, I reverted to an older version which solved the problem, still not sure what it was. Thanks so much for your help! Have a great day.

I also have this problem don't know how to debug this.

@ix-xerri I don't want to go back to rc2 because rc3 fixes a very important white screen problem.

Any news on this?

Ok, I installed a fresh ionic rc3 (and updated cli etc before that), and dropped my src in it. Now it works. Still not a clue why and how it failed. I do know I wasted a few hours on this one.

To Whom It May Concern, my package.json:

{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"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",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26",
"moment": "^2.15.2",
"firebase": "^3.6.1",
"angularfire2": "^2.0.0-beta.5",
"@types/jasmine": "^2.5.38"

},
"devDependencies": {
"@ionic/app-scripts": "0.0.45",
"typescript": "2.0.6"
},
"description": "myapp-rc3: 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 saving the same error:

console:
[03:30:43] ionic-app-scripts 0.0.45
[03:30:43] watch started ...
[03:30:43] build dev started ...
[03:30:43] clean started ...
[03:30:43] clean finished in 1 ms
[03:30:43] copy started ...
[03:30:43] transpile started ...
[03:30:46] build dev failed: Cannot read property 'indexOf' of undefined
[03:30:46] copy finished in 3.17 s
[03:30:46] watch ready in 3.26 s
[03:30:46] dev server running: http://localhost:8100/

browser(Chrome):
http://localhost:8100/build/main.css - Failed to load resource: the server responded with a status of 404 (Not Found)
http://0.0.0.0:35729/livereload.js?snipver=1 Failed to load resource: net::ERR_ADDRESS_INVALID
http://localhost:8100/build/main.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8100/build/main.css Failed to load resource: the server responded with a status of 404
(Not Found)

package.json
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"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",
"angularfire2": "^2.0.0-beta.6",
"firebase": "^3.6.1",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "0.0.45",
"@types/request": "0.0.30",
"typescript": "2.0.6"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-statusbar",
"cordova-plugin-console",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "palavraAmiga: An Ionic project"
}

Ionic Info:
ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed

Try to copy my package.json and ionic info (specifically the app-scripts) and run npm cache clean before any npm install just in case.

ix-xerri - I followed all your steps but the error continues. But thanks for trying to help. Although dowgrade is a temporary solution.

Not sure what to say. Npm cache clean just in case and copy my ionic info and package.json. I know those work

the same error here : Failed to load resource: net::ERR_ADDRESS_INVALID from chrome in console and got white screen nothing load....

What can I do?
Please help

Not sure I've never seen it. In my case the build did not complete.

I am seeing this same issue. I do not have any modifications to the build setup. The biggest issue for me here, is that I don't know where to start digging. With the "hidden from the devloper" approach to the build config, things like this take way longer to debug.

output from ionic info:

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: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v6.9.1
Xcode version: Not installed

Packag JSON:

{
  "name": "armadilo",
  "description": "armadilo: An Ionic project",
  "version": "1.0.3",  
  "private": true,
  "scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve --watch",
    "package": "ionic build ios",
    "package-test": "ENV=TEST && ionic build ios",
    "package-prod": "ENV=PROD && ionic build ios",
    "safe-install": "set http_proxy=http://OURPROXY:OURPORT && npm install",
    "start": "ionic serve --browser chrome --platform ios",
    "startlab": "ionic serve --browser chrome --lab",
    "test": "./node_modules/.bin/karma start"
  },
  "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",
    "@lge/ng2-cc": "^1.1.0",
    "angular2-busy": "1.0.2",
    "ionic-angular": "2.0.0-rc.3",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "lodash": "^4.13.1",
    "moment": "^2.13.0",
    "openlayers": "3.18.2",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@types/core-js": "^0.9.34",
    "@types/openlayers":"3.18.40",
    "@types/lodash":"4.14.41",
    "@types/moment":"2.13.0",
    "@ionic/app-scripts": "0.0.45",    
    "typescript": "2.0.6"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [
    "ios"
  ]  
}

ionic serve output:

> ionic-app-scripts serve --watch

[12:26:48]  ionic-app-scripts 0.0.45
[12:26:49]  watch started ...
[12:26:49]  build dev started ...
[12:26:49]  clean started ...
[12:26:49]  clean finished in 9 ms
[12:26:49]  copy started ...
[12:26:49]  transpile started ...
[12:27:04]  build dev failed: Cannot read property 'indexOf' of undefined
Config file "D:\git-repos\armadilo-upgrade\--" not found. Using defaults instead.
[12:27:04]  copy finished in 14.86 s
[12:27:04]  watch ready in 15.00 s
[12:27:04]  dev server running: http://localhost:8100/

@Barryrowe I had the same error . I solved it by removing everything related to types firebase in tsconfig.json. nothing is required. Dont install @types/firebase , otherwise it will give Duplicate identifier error.

Remove node modules completely. Re-install by npm install.

"angularfire2": "^2.0.0-beta.6",
 "firebase": "^3.6.1"

dev

`"@ionic/app-scripts": "^0.0.45"

EDIT :-

only update to app-scripts 45 helped me. firebase was specific to my project.

@uzumakinaruto123 Thanks, but I'm already on app-scripts 0.0.45, and I'm not using firebase :/.

@danbucholtz @Barryrowe - the same error here : Failed to load resource: net::ERR_ADDRESS_INVALID from chrome in console and got white screen nothing load....

What can I do?
Please help

There's a lot more info at #468

I'm also seeing: build dev failed: Cannot read property 'indexOf' of undefined

This only occurs for me when first running ionic serve. If I just edit one of my .ts files, it triggers a rebuild, and it builds fine after that.

the same issues and nothing appear on the screen!

It seems like the indexOf null pointer is swallowing a legitimate error. I'll investigate and fix in the coming days.

Thanks,
Dan

Same issue here, application has been working lately. But for some reason I decided to re-install everything.

Cordova CLI: 4.2.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.8 
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62
[15:23:56]  ionic-app-scripts 0.0.45 
[15:23:57]  watch started ... 
[15:23:57]  build dev started ... 
[15:23:57]  clean started ... 
[15:23:57]  clean finished in 5 ms 
[15:23:57]  copy started ... 
[15:23:57]  transpile started ... 
[15:24:01]  build dev failed: Cannot read property 'indexOf' of undefined 
[15:24:01]  copy: Error copying "/Users/Abdel/code/digidot-c4-app/src/manifest.json" to 
            "/Users/Abdel/code/digidot-c4-app/www/manifest.json": File not found 
[15:24:01]  copy finished in 4.75 s 
[15:24:01]  watch ready in 4.78 s 
[15:24:01]  dev server running: http://localhost:8100/ 

I have a strange feeling this has to do with node 6.9.1

If you take a look at this comment on https://github.com/driftyco/ionic-app-scripts/issues/468#issuecomment-263661409 you can see where we tracked this down to there being typescript errors that may exist, but somehow the logger isn't getting the expect input from the error reporter, and leads to an undefined reference.

In my case, I was able to patch a handful of files to get on to my next issue, but it's likely there are legitimate errors/warnings being eaten by that process. Appears from above @danbucholtz is looking into it.

All that being said, I have not seen this any further after resolving the remainder of my typescript errors and doing a full clean and npm install.

Something new?

@danbucholtz Problem is still here in 0.47

Can someone provide a concrete reproduction? I have still been unable to recreate.

Thanks,
Dan

I was having this problem with 0.0.45, 0.0.46, and 0.0.47. I tried all 3, and was still getting the error. I found the error was trying to use both AngularFire2 and firebase.js in the same page.js file. I had to break out my usage of firebase to a separate page (or you can possibly use a provider) to use firebase.js and return the value to the promise that needs the return value. I ended up using a Modal, and then using the dismiss method from the ViewController.

Call Modal:

    let modal = this.modalCtrl.create(page);
    // Getting data from the modal:
    modal.onDidDismiss(data => {
      console.log('MODAL DATA', JSON.stringify(data));
      this.doSomething(data);
    });

    modal.present(modal);

From Modal (make sure you include ViewController in the constructor):
this.viewCtrl.dismiss(data);

@danbucholtz

Try this on a ionic 2 angularfire project with ionic-app-scripts 0.0.45 (ionic-angular: 2.0.0-rc.3):

1) run the app in the browser:

ionic serve

2) Add a reference to firebase in any page and save:

import * as firebase from 'firebase';

3) ionic will build and serve as normal and the app will work normally in the browser.

4) now close ionic serve (cntrl+c)

5) now re-run ionic serve and the error msg should pop up:

build dev failed: Cannot read property 'indexOf' of undefined

6) This error message doesn't get detected when ionic serve is running. however once ionic serve restarts then this error gets picked up, at that point its hard to trace the error, unless u use git.

Hi guys,

I've the same issue after create a project with this command ionic start myPojectName blank --v2
I don't change anything in the project, I execute ionic serve and I get the error

This's my ionic info

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v4.5.0
Xcode version: Not installed

ionic serve output

[19:46:50] ionic-app-scripts 0.0.47
[19:46:51] watch started ...
[19:46:51] build dev started ...
[19:46:51] clean started ...
[19:46:51] clean finished in 6 ms
[19:46:51] copy started ...
[19:46:51] transpile started ...
[19:46:57] build dev failed: Cannot read property 'indexOf' of undefined
[19:46:57] dev server running: http://localhost:8100/

[19:46:57] copy finished in 6.39 s
[19:46:57] watch ready in 6.45 s

Hi
This ist a Problem with Firebase. For a temp Solution delete the Firebase.d.ts File in the Firebase folder and everthing should work.

Daniel

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.

Hi, I've started to get this issue on windows 10. I've removed node_modules and ran npm cache clean. I've also checked there is no instance of firebase. I've started a new ionic 2 project based on the tabs template ran npm install and ionic serve and the following is returned:

ionic-app-scripts serve

[08:36:29] ionic-app-scripts 0.0.47
[08:36:33] watch started ...
[08:36:33] build dev started ...
[08:36:33] clean started ...
[08:36:33] clean finished in 34 ms
[08:36:33] copy started ...
[08:36:33] transpile started ...
[08:36:53] build dev failed: Cannot read property 'indexOf' of undefined
[08:36:53] dev server running: http://localhost:8100/

[08:36:54] copy finished in 20.63 s
[08:36:54] watch ready in 20.95 s

If I then edit the main.ts and save the project auto rebuilds and loads fine. If I stop and serve again I get same error and need to edit a file again.

ionic info as follows:
Your system information:

ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed

Has anyone any thoughts on how to resolve this?

Update:
ionic-app-scripts 0.0.47
To:
ionic-app-scripts 0.0.48
npm update @ionic/app-scripts@latest --save-dev

That worked for me. Thank you!

On Wed, Dec 21, 2016 at 7:52 AM, Nilton Felicio notifications@github.com
wrote:

Update:
ionic-app-scripts 0.0.47
To:
ionic-app-scripts 0.0.48
npm update @ionic/app-scripts@latest --save-dev

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/driftyco/ionic-app-scripts/issues/340#issuecomment-268557284,
or mute the thread
https://github.com/notifications/unsubscribe-auth/APxEZWKWR2RpqEs6z2bCIuABhhVnVAOVks5rKUslgaJpZM4KuBS8
.

@NiltonFelicio , thanks for the help and Sorry for the delay, After clearing everything out when I run the npm update @ionic/app-scripts@latest --save-dev command I still get version 0.0.47. However after clearing this all out and starting from a tabs template it is finally building again without errors. Thanks Mike

same issue here:

Project works fine with ionic 2.0.0-rc.3,
after migrating from version 2.0.0-rc.3 to version 2.0.0.-rc.5 it started giving error.

Also, I tried fresh npm installation still same error occurs.

Error:

build dev failed: Cannot set property 'fileSystem' of null

> ionic-hello-world@ ionic:serve /home/tushar/NxtLifeYugma2
> ionic-app-scripts serve "--v2" "--lab" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"

[13:56:05]  ionic-app-scripts 0.0.45 
[13:56:05]  watch started ... 
[13:56:05]  build dev started ... 
[13:56:05]  clean started ... 
[13:56:05]  clean finished in 3 ms 
[13:56:05]  copy started ... 
[13:56:05]  transpile started ... 
[13:56:09]  transpile finished in 3.97 s 
[13:56:09]  webpack started ... 
[13:56:10]  build dev failed: Cannot set property 'fileSystem' of null
[13:56:10]  copy finished in 4.15 s 
[13:56:10]  watch ready in 4.19 s 
[13:56:10]  dev server running: http://localhost:8100/

Ionic info:

Your system information:
Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.5
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.6
Node Version: v4.6.0
Xcode version: Not installed

@Tusharbalar Try to update ionic-app-scripts to version 1.0.0 (see devDependencies in package.json). It worked for me.

edit: Have a look at the upgrade instructions for 1.0.0 https://github.com/driftyco/ionic-app-scripts/blob/master/CHANGELOG.md

You need to add sw-toolbox

npm install sw-toolbox --save --save-exact

Thanks @MartinMa, after updating to version 1.0.0 I got a new error

[15:49:50]  watch failed: A watch configured to watch the following paths failed to start. It likely that a file 
            referenced does not exist: /home/tushar/NxtLifeYugma2/src/assets/**/*, 
            /home/tushar/NxtLifeYugma2/src/index.html, /home/tushar/NxtLifeYugma2/src/manifest.json, 
            /home/tushar/NxtLifeYugma2/src/service-worker.js, 
            /home/tushar/NxtLifeYugma2/node_modules/ionicons/dist/fonts/**/*, 
            /home/tushar/NxtLifeYugma2/node_modules/ionic-angular/fonts/**/*, 
            /home/tushar/NxtLifeYugma2/node_modules/ionic-angular/polyfills/polyfills.js, 
            /home/tushar/NxtLifeYugma2/node_modules/sw-toolbox/sw-toolbox.js 
[15:49:50]  ionic-app-script task: "watch" 
[15:49:50]  Error: A watch configured to watch the following paths failed to start. It likely that a file referenced 
            does not exist: /home/tushar/NxtLifeYugma2/src/assets/**/*, /home/tushar/NxtLifeYugma2/src/index.html, 
            /home/tushar/NxtLifeYugma2/src/manifest.json, /home/tushar/NxtLifeYugma2/src/service-worker.js, 
            /home/tushar/NxtLifeYugma2/node_modules/ionicons/dist/fonts/**/*, 
            /home/tushar/NxtLifeYugma2/node_modules/ionic-angular/fonts/**/*, 
            /home/tushar/NxtLifeYugma2/node_modules/ionic-angular/polyfills/polyfills.js, 
            /home/tushar/NxtLifeYugma2/node_modules/sw-toolbox/sw-toolbox.js

@MartinMa, Thank you :+1: Updating ionic-app-scripts to version 1.0.0 worked for me.
@Tusharbalar, If you also have updated sw-toolbox, delete and re install all the new dependencies (might work).

Thanks, @MartinMa It works for me.

For me the output when running has an error saying:

build dev failed: Cannot set property 'fileSystem' of null

Build does not fail when I do:

ionic build android

But it does when I do:

ionic run android -l -p 9999 -r 9998 -c

I am on 0.0.45, how do I update to 1.0.0?

This solved it for me:

npm install -g ionic
npm install @ionic/app-scripts@latest --save-dev
npm install sw-toolbox
Was this page helpful?
0 / 5 - 0 ratings

Related issues

isflo96 picture isflo96  Â·  3Comments

danbucholtz picture danbucholtz  Â·  4Comments

itryan picture itryan  Â·  3Comments

mburger81 picture mburger81  Â·  4Comments

danbucholtz picture danbucholtz  Â·  4Comments