Angular-socket-io, io is not defined

Anyone know solution to: io is not defined

There was a suggestion here:

  • make sure you have client library:

      bower install --save

This didn’t fix my problem with this same error. I’m using Ionic (AngularJS)

  • including in index.html:

      script src="lib/angular-socket-io/socket.js"
  • in app.js

      angular.module('starter', ['ionic', 'starter.controllers', '',       
       'starter.directives', 'btford.socket-io'])
  • in services.js

         var myIoSocket = io.connect(porturl); // io is not defined here, suddenly.
  • It was working before, using a remote copy of the lib. When this error started, I changed index.html to link a local copy, as this remote version also received a Bad Gateway error (now fine, but still socket io is not defined as above).


script src=""

versions node_modules/
node --version
npm --version
nvm --version
ionic --version

I had same problem and read somewhere than doesn’t support bower.
For this reason, if you install this package thru bower, you should add in your bower.json following overrides to allow your build tools to include the script

“overrides”: {
“”: {
“main”: “”