socketio and nodejs, error 404 /socket.io/socket.io.js

I'm getting this error "NetworkError: 404 Not Found - http://localhost:3000/socket.io/socket.io.js" and I don't know how can I fix it. I have tried changing the port, adding the link with the port ... and I have no idea.

My app.js :

var express = require('express')
  , http = require('http')
  , stylus = require('stylus')
  , nib = require('nib')


var app = express();
var server = http.createServer(app);
var io = require('socket.io').listen(server);


function compile(str, path) {
  return stylus(str)
    .set('filename', path)
    .use(nib());
}

app.set('views', __dirname + '/views')
app.set('view engine', 'jade')
app.use(express.logger('dev'))
app.use(stylus.middleware(
  { src: __dirname + '/public'
  , compile: compile
  }
))
app.use(express.static(__dirname + '/public'))

app.get('/', function (req, res) {
  res.render('index',
  { title : 'Home' }
  )
})

app.listen(3000)

note: The console said it's ok ( info - socket.io started )

Anyway I have tried this

app.listen(app.get('port'), function(){
   console.log("Express server listening on port " + app.get('port'));
});

but doesn't print the port, say me undefined

You are creating an express HTTP server as well as a standard HTTP server. The app in your example above refers to the Express app which does not have .get('port'); method, try using server.listen. For example:

var express = require('express');
var http = require('http');

var app = express();
var server = http.createServer(app);

app.get('/', function(req, res) {
    res.send("Hello World!");
});

server.listen(3000);
console.log('Express server started on port %s', server.address().port);