# Error when build or run

**URL:** <https://forum.ionicframework.com/t/error-when-build-or-run/92149>\
**Category:** ionic-v3\
**Created:** [May 29, 2017, 1:24pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149 "2017-05-29T13:24:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![alibahjat](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@alibahjat](https://forum.ionicframework.com/u/alibahjat)\
**Post date:** [May 29, 2017, 1:24pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/1 "2017-05-29T13:24:03Z")

</div>

hello  
i got error when build or run for ios or android app from terminal in ionic 3

```auto
[WARN] Error occurred during command execution from a CLI plugin. Your plugins may be
out of date.
TypeError: Cannot read property 'length' of undefined

```

the app work normally when serve it

this is my package.json

```auto

{
    "name": "ward44",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.1.0",
        "@angular/compiler": "4.1.0",
        "@angular/compiler-cli": "4.1.0",
        "@angular/core": "4.1.0",
        "@angular/forms": "4.1.0",
        "@angular/http": "4.1.0",
        "@angular/platform-browser": "4.1.0",
        "@angular/platform-browser-dynamic": "4.1.0",
        "@ionic-native/core": "3.7.0",
        "@ionic-native/in-app-browser": "^3.10.3",
        "@ionic-native/splash-screen": "3.7.0",
        "@ionic-native/status-bar": "3.7.0",
        "@ionic/storage": "2.0.1",
        "cordova-android": "^6.2.3",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-console": "1.0.5",
        "cordova-plugin-crosswalk-webview": "~2.3.0",
        "cordova-plugin-device": "1.1.4",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-media-capture": "*",
        "cordova-plugin-splashscreen": "~4.0.1",
        "cordova-plugin-statusbar": "2.2.2",
        "cordova-plugin-whitelist": "1.3.1",
        "ionic-angular": "3.2.1",
        "ionic-plugin-keyboard": "~2.2.1",
        "ionicons": "3.0.0",
        "onesignal-cordova-plugin": "~2.1.1",
        "rxjs": "5.1.1",
        "sw-toolbox": "3.4.0",
        "zone.js": "^0.8.10"
    },
    "devDependencies": {
        "@ionic/app-scripts": "1.3.7",
        "@ionic/cli-plugin-cordova": "1.0.0",
        "@ionic/cli-plugin-ionic-angular": "1.2.0",
        "typescript": "~2.2.1"
    },
    "description": "An Ionic project",
    "cordova": {
        "platforms": [
            "android",
            "ios"
        ],
        "plugins": {
            "cordova-plugin-console": {},
            "cordova-plugin-crosswalk-webview": {},
            "cordova-plugin-device": {},
            "cordova-plugin-media-capture": {
                "CAMERA_USAGE_DESCRIPTION": "App would like to access the camera.",
                "MICROPHONE_USAGE_DESCRIPTION": "App would like to access the microphone.",
                "PHOTOLIBRARY_USAGE_DESCRIPTION": "App would like to access the library."
            },
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "onesignal-cordova-plugin": {},
            "cordova-plugin-inappbrowser": {}
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![alibahjat](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@alibahjat](https://forum.ionicframework.com/u/alibahjat)\
**Post date:** [May 29, 2017, 3:01pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/2 "2017-05-29T15:01:40Z")

</div>

please help me to solve this

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 29, 2017, 3:02pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/3 "2017-05-29T15:02:09Z")

</div>

Two things to try:

Update all packages to latest, delete your node\_modules and run npm install

Make sure all your files and folders are lower case and the references to them in the .ts import statements are also lower case.

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 29, 2017, 3:53pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/4 "2017-05-29T15:53:11Z")

</div>

Sorry about the previous typo 🙂 ‘Erosions’ lol.  
iPhone typing!

---

<div class="post-metadata">

**Author:** ![lbrockma](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lbrockma](https://forum.ionicframework.com/u/lbrockma)\
**Post date:** [May 29, 2017, 11:02pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/5 "2017-05-29T23:02:44Z")

</div>

I am having the same issue here. I just get a generic “Error: Cannot read property ‘length’ of undefined”

This occurs just after cordova build begins to start.

![image](https://global.discourse-cdn.com/ionicframework/original/3X/7/c/7cbda612393542a90daa23078fc636abd5168c09.png)

I read your above answer, but I am a little curious as to how to update all packages to the latest? What exactly are packages (how can I decipher which ones I need to run an update command on, or is there a master command that will find and update all for me?).

Can you provide a more itemized way to begin troubleshooting this? I have already cloned my repository to a new folder, done a fresh npm install, npm install -g cordova && npm install -g ionic, as well as npm install for my other dependent modules and added plugins back to the app.

FWIW, this issue started with an upgrade to Ionic 3, and has followed as I deleted my existing project folder and cloned from the repository.

Thanks for any help in advance.

-LB

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 29, 2017, 11:09pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/6 "2017-05-29T23:09:52Z")

</div>

Not sure your problem is the same albeit with similar symptoms.

To test building at all can you try building for browser and see if that works? That would eliminate the Ionic/Cordova side and square the blame at the Java side…

```auto
ionic cordova build browser --prod

```

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 29, 2017, 11:12pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/7 "2017-05-29T23:12:16Z")

</div>

Also on the front of up-to-date packages - I’m referring to your packages.json file.

You If you are using VSCode you can get a plugin called ‘Version Lens’ which shows you what you currently have and what’s the latest…

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/8/b/8bec95ef380a0aa13b776a0785020ff87f47418d.png)

---

<div class="post-metadata">

**Author:** ![lbrockma](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lbrockma](https://forum.ionicframework.com/u/lbrockma)\
**Post date:** [May 29, 2017, 11:17pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/8 "2017-05-29T23:17:49Z")

</div>

I am able to ionic serve (and run through the test environment) and things run fine. I will try the browser now and get back with you.

Also, I’ll have to slow down my responses since I am replying to quickly ;).

I will check into version lens plugin and see what I cannot figure out. More to come, thanks for your reply.

---

<div class="post-metadata">

**Author:** ![lbrockma](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lbrockma](https://forum.ionicframework.com/u/lbrockma)\
**Post date:** [May 29, 2017, 11:37pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/9 "2017-05-29T23:37:15Z")

</div>

Ok… It appears I cannot build to browser either.

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/f/2/f2eacfa99b780842e28766cab0be8d2df7050514.png)

I get an error:

TypeError: Cannot Read Property ‘codeGen’ of undefined.

I looked through the packages.json and everything meets the requirements (though some are not the latest).

Any ideas as to a logical next step?

Attached is also an image of packages.json (which has GROWN since the upgrade :)).

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/5/5/5538b43b129ed25324060fc8420b1d9ce902b2ca.png)

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/2/e/2eddc0033b919803d91542e170946ac83e236b8d.png)

---

<div class="post-metadata">

**Author:** ![wterrill](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@wterrill](https://forum.ionicframework.com/u/wterrill)\
**Post date:** [May 29, 2017, 11:38pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/10 "2017-05-29T23:38:49Z")

</div>

what is the difference between “building for browser” and “ionic serve?”

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 29, 2017, 11:40pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/11 "2017-05-29T23:40:03Z")

</div>

Produces a build which you could deploy to web servers I think.

It’s a production version which removes all the debug code from the payload.

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 29, 2017, 11:44pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/12 "2017-05-29T23:44:34Z")

</div>

Upgrade your stuff, remove the node\_modules directory - npm install, try again…?

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [May 29, 2017, 11:47pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/13 "2017-05-29T23:47:42Z")

</div>

Can you pretty please post text as text, not as images?

---

<div class="post-metadata">

**Author:** ![lbrockma](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lbrockma](https://forum.ionicframework.com/u/lbrockma)\
**Post date:** [May 30, 2017, 12:10am UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/14 "2017-05-30T00:10:58Z")

</div>

Geting the same result, when I run

ionic cordova run android --verbose

Error: Cannot read property ‘length’ of undefined.

on the intial build I get a

Throwing PLUGIN\_NOT\_INSTALLED for global @ionic/cli-plugin-proxy (though I am not using a proxy server).

If I do…

ionic cordova build browser --prod

It IS successful. This is also giving the:

Throwing PLUGIN\_NOT\_INSTALLED for global @ionic/cli-plugin-proxy

but continues and succeeds to build.

_scratching my head_

I did get some unmet dependency warnings for react and rxjs when I ran npm install… That’s about the only other clue I see popping up right now? (I tried to force – npm install react and npm install rxjs but neither was successful).

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 30, 2017, 12:19am UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/15 "2017-05-30T00:19:40Z")

</div>

Last thing to try…

This is a little more effort - but if you have an ionic account, try letting Ionic build it to see if it’s possible.

```auto
ionic package build android --prod

```

It’ll build it obv without a certificate, but will eliminate this time your own computer.

---

<div class="post-metadata">

**Author:** ![lbrockma](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lbrockma](https://forum.ionicframework.com/u/lbrockma)\
**Post date:** [May 30, 2017, 12:26am UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/16 "2017-05-30T00:26:01Z")

</div>

This one kicks out with a

TypeError: Cannot read property ‘codeGen’ of undefined

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/6/7/67ae305f3002a9afa8b8fb3c65484b46144bbb64.png)

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 30, 2017, 12:39am UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/17 "2017-05-30T00:39:27Z")

</div>

Are you in a position to share the code with me?

I’ve seen an article that suggests a version mismatch with angular…

> <https://github.com/ionic-team/ionic-app-scripts/issues/918>

---

<div class="post-metadata">

**Author:** ![lbrockma](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lbrockma](https://forum.ionicframework.com/u/lbrockma)\
**Post date:** [May 30, 2017, 12:57am UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/18 "2017-05-30T00:57:06Z")

</div>

Yes I can. What is the best way to get you something?

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [May 30, 2017, 6:25am UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/19 "2017-05-30T06:25:34Z")

</div>

Hi,

GitHub is always easiest.

If you don’t want to publicly share just share with my account, judgewest2000.

---

<div class="post-metadata">

**Author:** ![lbrockma](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lbrockma](https://forum.ionicframework.com/u/lbrockma)\
**Post date:** [May 30, 2017, 9:48pm UTC](https://forum.ionicframework.com/t/error-when-build-or-run/92149/20 "2017-05-30T21:48:23Z")

</div>

Sorry for the delay in response. I ended up moving the dot a little further last night. I found a few of the dependencies were not actually upating on npm update (I had to update packages.json manually then ensure that dependencies were installed correctly on npm install – even then some I had to do npm update @latest).

I found a multitude of items broken (a lot of ionic-native and some older plugins like splash-screen, etc., as well as angularfire2 and some image map stuff) after the update. I started trying to find and fix those dependencies but there were way to many changes in a lot of them (angularfire2 is pretty drastically different from 2.0.0 to 4.0.0) to fix them in one fell swoop.

I am going back to ionic 2.2.1 (my colleague got our project working in that version) and I will slowly start updating modifying my dependencies from there, one by one.

It seems we may have been a bit overzealous in trying to jump to ionic 3 🙂, so we are going to take our foot off the gas and try to do this incrementally. I will update you with any errors / problems I may run into – but for now I think to many things are changing at once to accurately pinpoint a single error.

Thanks for your patience and help with this; it is really appreciated.

[Next page](https://forum.ionicframework.com/t/error-when-build-or-run/92149.md?page=2)
