Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"io is not defined" error when using MEAN.js #77

Closed
skyserpent opened this issue Sep 7, 2014 · 4 comments
Closed

"io is not defined" error when using MEAN.js #77

skyserpent opened this issue Sep 7, 2014 · 4 comments

Comments

@skyserpent
Copy link

Hey everyone, I'm using [email protected] and I have made a gist of my angular controller here:
https://gist.github.com/skyserpent/832f980ca9ed9ed30e4b

My JS assets are loaded like this:
...
'//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js',
'public/lib/angular-socket-io/socket.js'

I have even included 'btford.socket-io' in Angular's 'applicationModuleVendorDependencies' but for some reason I get an error saying "io is not defined" in line 6 of the gist I uploaded.

Any help is much appreciated.

@connor11528
Copy link

make sure you have socket.io client library: bower install socket.io-client --save

@Arduinology
Copy link

Thanks @jasonshark that was the solution for me. I was trying to get this working in the Ionic Framework.

@btford
Copy link
Owner

btford commented Dec 26, 2014

Closing, since this seems to have been resolved. It's also documented in the README.

@btford btford closed this as completed Dec 26, 2014
@adaptivedev
Copy link

This didn't fix my problem with this same error. I've reposted: #127

  • make sure you have socket.io client library: bower install socket.io-client --save

This didn't fix my problem with this same error.

  • including in index.html:
    script src="lib/angular-socket-io/socket.js"
  • in app.js
    angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'starter.directives', 'btford.socket-io'])
  • in services.js

.factory('seatStatusSocket',function(socketFactory){
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).

  • removed: script src="http://chat.socket.io/socket.io/socket.io.js"

  • versions

    [email protected] node_modules/socket.io
    node --version
    v0.12.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants