title: Socket.io client: Getting error "io is not defined" or "#<Object> has no method 'connect'"
body: <p>Ok so I'm basically having the same problem as <a href="https://stackoverflow.com/questions/7603224/node-server-socket-io-io-is-not-defined">this</a>. But the answers given there don't work for me. So let me re-explain my problem. First of all, here's my code:
  <br><strong>Server-Side Javascript (app.js)</strong></p>
  
  <pre><code>var io = require('socket.io');
  ...
  var sio = io.listen(app);
  </code></pre>
  
  <p><br><strong>Client-Side Javascript (client.js)</strong></p>
  
  <pre><code>3: var socket = (s)io.connect('http://localhost:3000');
  //the (s) represents testing with and without the s out of desperateness :)
  </code></pre>
  
  <p><strong>Client-Side Template (Jade)</strong></p>
  
  <pre><code>script(src='/socket.io/socket.io.js')
  script(src='/javascripts/client.js')
  </code></pre>
  
  <p>So from what I've read it seems like socket.io should be handling putting the socket.io.js file there but I'm guessing that I have something configured wrong because it's not doing that. Anyways the errors I get with this are:</p>
  
  <pre><code>GET http://localhost:3000/socket.io/socket.io.js 404 (Not Found)
  Uncaught ReferenceError: io is not defined - client.js line 3
  </code></pre>
  
  <p>After doing some research it seemed that I could change the jade file to link directly to a stable file. So by changing my code to this:
  <br><strong>Client-Side Template (Jade)</strong></p>
  
  <pre><code>script(src='http://cdn.socket.io/stable/socket.io.js')
  script(src='/javascripts/client.js')
  </code></pre>
  
  <p>Then the error that I get from this is:</p>
  
  <pre><code>Uncaught TypeError: Object #&lt;Object&gt; has no method 'connect' - client.js line 3
  </code></pre>
  
  <p>I've been trying to figure this out for hours now. And it seems that I need to have socket.io-client so I made sure that it is installed. I dunno if this will but I am using Express.js as well and I will give you the layout of my files. 
  <br><strong>/project</strong></p>
  
  <pre><code>app.js  /node_modules  package.json  /public  /routes  /views
  </code></pre>
  
  <p><strong>/project/node_modules</strong></p>
  
  <pre><code>/connect  /express  /jade  /jquery  /socket.io  /stylus
  </code></pre>
  
  <p><strong>/project/node_modules/socket.io</strong></p>
  
  <pre><code>/benchmarks  index.js  Makefile       package.json  restrict_jsonp.patch
  History.md   /lib      /node_modules  Readme.md
  </code></pre>
  
  <p><strong>/project/node_modules/socket.io/node_modules</strong></p>
  
  <pre><code>/policyfile  /redis  /socket.io-client
  </code></pre>
  
  <p><strong>/project/public</strong></p>
  
  <pre><code>/images  /javascripts  /jquery  /stylesheets
  </code></pre>
  
  <p><strong>/project/public/javascripts</strong></p>
  
  <pre><code>client.js
  </code></pre>
  
  <p>Anyways, any help would be greatly appreciated! :)</p>