title: socket.io.js not found on client
body: <p>This question has been asked previously but haven't found any solution in prior replies.</p>
  
  <p>Socket.IO gives me two problems:</p>
  
  <ol>
  <li>server side gave this error - ERROR - listen EACESS
  I read stackoverflow and resolved this with issuing a sudo command to start the server.</li>
  <li><p>now clientside doesnt seem to find the socket.io.js file as per the script line  - </p>
  
  </li>
  </ol>
  
  <p>I understand file is not found by using the chrome developer tools console which has a 404 error on the file.</p>
  
  <p>I read that this file is created on the fly by server. But I did a 'ls-a' on the root folder. Couldn't find the socket.io/socket.io.js file. </p>
  
  <p>Any ideas?</p>
  
  <p>For reference here is my server code -</p>
  
  <pre><code>var http = require('http'),
    path = require("path"),
    url = require("url"),
    fs = require("fs"),
    mime = require("mime"),
    io = require("socket.io").listen(server);
  var homepath = ".";
  var server = http.createServer(function (req, res) {
    var uri = url.parse(req.url).pathname;
    var filepath = path.join(homepath, uri);
    console.log(filepath);
    path.exists(filepath, function (exists) {
      if (!exists) {
        //404 response
        res.writeHead(404, {
          "Content-Type": "text/plain"
        });
        res.write("404 File not Found \n");
        res.end();
      } else {
        if (fs.statSync(filepath).isDirectory()) {
          filepath += '/index.html';
          filepath = path.normalize(filepath);
        }
        fs.readFile(filepath, "binary", function (err, data) {
          if (err) {
            res.writeHead(500, {
              'Content-Type': 'text/plain'
            });
            res.write('500 File read error \n');
            res.end();
          } else {
            var contentType = mime.lookup(filepath);
            res.writeHead(200, {
              'Content-Type': contentType
            });
            res.write(data, 'binary');
            res.end();
          }
        });
      }
    });
    //sockets part starts here
    io.sockets.on('connection', function (socket) {
      socket.on('test', function (data) {
        console.log('i got something');
        console.log(data.print);
      });
    });
  });
  server.listen(3000);
  server.on('error', function (e) {
    console.log(e);
  });
  console.log('Server listening on Port 3000');
  </code></pre>