Uncaught TypeError: b.addPollFn is not a function

I have this error in my app:

 Uncaught TypeError: b.addPollFn is not a function

I have tried to update angular-cookies (when I read this thread) and angular-resource with the commands:

sudo npm update -g angular-resource
sudo npm update -g angular-cookies

but I was not sure I had this packages installed so I tried this:

$ sudo npm install -g angular-cookies
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires once@'~1.1.1' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/once,
npm WARN unmet dependency which is version 1.3.2
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires mkdirp@'~0.3.3' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/mkdirp,
npm WARN unmet dependency which is version 0.5.1
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires osenv@'0.0.3' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/osenv,
npm WARN unmet dependency which is version 0.1.3
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires nopt@'2' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/nopt,
npm WARN unmet dependency which is version 3.0.4
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires semver@'2' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/semver,
npm WARN unmet dependency which is version 5.0.3
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires ini@'~1.1.0' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/ini,
npm WARN unmet dependency which is version 1.3.4
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data requires semver@'2' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/semver,
npm WARN unmet dependency which is version 5.0.3
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data requires github-url-from-git@'~1.1.1' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/github-url-from-git,
npm WARN unmet dependency which is version 1.4.0
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/read-installed/node_modules/readdir-scoped-modules requires graceful-fs@'^4.1.2' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/read-installed/node_modules/graceful-fs,
npm WARN unmet dependency which is version 3.0.8
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/phonegap-build requires colors@'0.6.x' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/phonegap-build/node_modules/qrcode-terminal requires colors@'*' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/prompt/node_modules/winston requires colors@'0.x.x' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
angular-cookies@1.4.7 /usr/local/lib/node_modules/angular-cookies

my bower.json in case that’s useful:

{
  "name": "BoardLine",
  "private": "true",
  "devDependencies": {
    "ionic": "driftyco/ionic-bower#1.1.0",
    "angular-pouchdb": "~3.0.0"
  },
  "dependencies": {
    "angular-pouchdb": "~3.0.0"
  }
}

I am really confused as you can see, can you help me please clear this out ?
Should I use bower or npm by the way ?

Thanks

Angular resource and cookies should both be updated via bower.

The way to think about it is bower is mainly used for javascript/css code bases (bootstrap, angular, font awesome) where as npm is mainly used for things your local computer needs like compilers, run time commands, etc.

Though I don’t think your error is with Angular resource. Mind posting the entire error you are getting?

thanks for answering @DaDanny, I get this error in the console, when I run my app with ionic serve.
I see nothing more than :

Uncaught TypeError: b.addPollFn is not a function                         ionic.bundle.min.js:69

I am not sure my ionic/angular distribution is clean though, because sometimes I get asked to choose a version of angular when using npm.

I also have to mention that I have upgraded ionic from 1.0.0beta to 1.1.0.

Then I just run now :

$ bower update angular-cookies
bower cached        git://github.com/angular/bower-angular-cookies.git#1.4.7
bower validate      1.4.7 against git://github.com/angular/bower-angular-cookies.git#~1.4.7
$ bower update angular-resource
bower cached        git://github.com/angular/bower-angular-resource.git#1.4.7
bower validate      1.4.7 against git://github.com/angular/bower-angular-resource.git#~1.4.7

As mentioned here shouldn’t I be using version angular 1.2.17… I am confused about this too :wink:

I reverted to a previous commit with git.
Re-upgraded to ionic 1.1.0. And it seems ok now.
Weird…

Sometimes when you update a bower component, you’ll be asked which version of a library you need to use. It will say something like

  1. angular 1.3.7 is required by ionic.js but resolved to 1.4.0
  2. angular 1.4.0 is required by ui-router but resolved to 1.4.0

please choose which version:

And what is happening is sometimes bower components require angular or another library, and you need to make sure you have the correct one installed.

It can be a tedious process at first. I remember I broke an app by upgrading and spent a few hours tracking down library versions or what not.

The best way to do it sometimes is to delete your bower_components folder and run bower install again. Just make sure your main bower.json is updated and has all the correct bower_components. Bower install will look at that file to check what to install.

Hope that helps with the mystery :smile:
and glad you got it working

I tracked back the changes, and this error happens when I try to upgrade ionic : ionic lib update.
It’s really weird because before upgrading like this, I get the following :

$ ionic info

Your system information:

Cordova CLI: 5.3.3
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.0
Ionic Version: 1.1.0
Ionic CLI Version: 1.7.7
Ionic App Lib Version: 0.6.3
OS: Distributor ID:	Ubuntu Description:	Ubuntu 14.04.3 LTS 
Node Version: v0.12.7

but in the file www/libe/ionic/js/ionic.bundle.min.js (which I call in my index.html), there is :

/*!
 * Copyright 2014 Drifty Co.
 * http://drifty.com/
 *
 * Ionic, v1.0.0-beta.13
 * A powerful HTML5 mobile app framework.

I think it’s a big mess because there is also this directory www/lib/ionic/release/js/ where ionic.bundle.min.js is to version 1.1.0.

Can you help me clarify this please ?

About what you said, I understand what to put in my bower.json, I mean I don’t which version of the package should I use. Isn’t there a package manager that can manage dependencies for me ?

The package manager is the bower.json and package.json files. I’m not sure if there is a better library to help manage them, but I wouldn’t be surprised.

I would try deleting the bower_components folder, making sure your bower.json file has everything upto date or latest version, and then running bower install again.

ok thanks @DaDanny for your reply. So, you say the pacakges should all be at their latest version in bower.json ?
If yes, how can I know what is their latest version ?

Thanks