ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 302 forks source link

[0.0.42] build dev failed #340

Closed biesbjerg closed 7 years ago

biesbjerg commented 7 years ago

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

uzumakinaruto123 commented 7 years ago

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

Barryrowe commented 7 years ago

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

MELAS007 commented 7 years ago

@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

ascorbic commented 7 years ago

There's a lot more info at #468

scottlepp commented 7 years ago

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.

MELAS007 commented 7 years ago

the same issues and nothing appear on the screen!

danbucholtz commented 7 years ago

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

Thanks, Dan

abdel-ships-it commented 7 years ago

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

Barryrowe commented 7 years ago

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.

danielehrhardt commented 7 years ago

Something new?

askona commented 7 years ago

@danbucholtz Problem is still here in 0.47

danbucholtz commented 7 years ago

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

Thanks, Dan

billygerhard commented 7 years ago

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

gujiman commented 7 years ago

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

ThonyFD commented 7 years ago

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

danielehrhardt commented 7 years ago

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

NiltonFelicio commented 7 years ago

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.

mikejshortland commented 7 years ago

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?

NiltonFelicio commented 7 years ago

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

thomastthai commented 7 years ago

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 .

mikejshortland commented 7 years ago

@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

Tusharbalar commented 7 years ago

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
MartinMa commented 7 years ago

@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
Tusharbalar commented 7 years ago

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
vemu commented 7 years ago

@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).

Tusharbalar commented 7 years ago

Thanks, @MartinMa It works for me.

g8d3 commented 7 years ago

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?

g8d3 commented 7 years ago

This solved it for me:

npm install -g ionic
npm install @ionic/app-scripts@latest --save-dev
npm install sw-toolbox