Ionic serve error Cannot read property 'call' of undefined

run ionic serve and get this error

Runtime Error
Cannot read property ‘call’ of undefined

TypeError: Cannot read property ‘call’ of undefined
at webpack_require (http://localhost:8100/build/vendor.js:55:29)
at Object.40 (http://localhost:8100/build/main.js:3747:83)
at webpack_require (http://localhost:8100/build/vendor.js:55:30)
at webpackJsonpCallback (http://localhost:8100/build/vendor.js:26:23)
at http://localhost:8100/build/main.js:1:1

my info:
Ionic Framework: 3.5.0
Ionic App Scripts: 2.0.0
Angular Core: 4.1.3
Angular Compiler CLI: 4.1.3
Node: 6.11.0
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

5 Likes

can you post some of your coide ? it sims some variable not dichiarated …

i create new blank project without 1 line of code
only the stater project code

But if i run on android its works perfect.
With the command “ionic cordova run android”

Me too, I think this issue of Ionic 3

Hello,
I have this same problem when executing the command

$ ionic serve 

any solution ??

The same problem. Removed 3.5.0, reinstalled 3.4.0 and will be show the same error in the browser for ionic framework 3.5.0. Npm shows 3.4.0 version on my laptop.

Try this:
npm install npm@latest -g
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest
and then:
npm install @angular/tsc-wrapped autoprefixer

hi, it doesn’t work for me :grinning:

I’m having the same issue.
Here is how I can replicate it:

  1. use ionic serve to view my app in the browser
  2. execute ionic cordova run android (while ionic serve is running)
  3. I now get the error when refreshing the browser.

The only solution is re-executing ionic serve.

14 Likes

I have the same issue

This happen when you are running multiple “ionic serve” in the same machine.

Maybe you forgot to stop some of these commands.

In windows, I recommend running as Admin: “taskkill -f -im node*” without the quotes. This will stop every node process (ionic serve / ionic emulate for example).

12 Likes

This keeps happening to me too. It goes away when I re-execute ionic serve. Its an annoying bug because at first I thought it was buggy code (still might be?) but since a lot of different people are getting the same error, it might be something else. I dont mind using ionic serve to restart the page, but once I build my app and deploy an apk, will the bug still randomly show up?

2 Likes

I’m having the same issue here, and I have found no ways to solve this.
Every time I make changes to my code the dev server just gets the error and stop working.
Why do we have a dev server at all if it won’t work.

This should have priority in the pipeline for ionic.
Issues like these make people waste serious time and money with debugging code that should just work when the stack is the culprit.

4 Likes

I had the same issue on my PWA and solved it by the order we are calling / caching the vendor.js. vendor.js has to be called first before main.js on the index.html and in the same way we have to cache it on the service worker first before caching main.js. If main.js started referring the vendor.js before it loads we might get the above error.

5 Likes

In my case I don’t have a service worker caching assets but as @brug360 said I was executing 2 applications with ionic serve by the project demand, so I’m having to slow down my development switching instances instead of working on both code bases as usual.

One more finding from my side for this problem is CDN cache… we are using CDN for serving static assets and since ionic app consists of html, js and css our CDN cached some older version of our app (ex) main.js its referring 37.js and this 37.js was cached at the CDN end with some older version. Finally we purged the file at the CDN end and we got rid of this issue… Try that out and update me

I dont know if this helps anybody at all, but I got this problem and it was as simple as the fact I had generated a page with a number as the first character in the name, once I deleted this then all was perfect

I don’t have any numbers. But still have this error. My system is archlinux and latest node ionic npm version

Hi, I have the same issue in Ionic 3 PWA.
The error happened when i do some action(click or navigate) after app was served
It happened once in a while, not everytime.
I have also deployed the app in firebase host.
This error will sometime show when i open the app.
I suspect this is problem of the service worker.
I have try @manoemerson, but its not work, the error remain, below is my service worker

self.toolbox.precache(
[
’./build/vendor.js’,
’./build/main.js’,
’./build/main.css’,
’./build/polyfills.js’,
‘db1.json’,
‘index.html’,
‘manifest.json’

]
);

This probably happen because something is not finish loaded, when i click a button, then error of Cannot read property ‘call’ of undefined

Anyone have solution for this?