mafintosh / router

a lean and mean http router for node.js
66 stars 14 forks source link

throw new TypeError('argument callback is required') #9

Open Thiggel opened 9 years ago

Thiggel commented 9 years ago

I'm trying to use router for my node app, but It doesn't work. this is my code:

http = require 'http'
util = require 'util'
router = require 'router'
Modules = require './modules'
cson = require 'cson'

route = router()

route.get '/', (req, res) ->
    res.writeHead(200)
    res.end('hello index page')

http.createServer(route).listen(8080)

and the result is:

localhost:smoothic Filipe$ coffee app.coffee

/Users/Filipe/Desktop/Smoothic/node_modules/router/index.js:156
    throw new TypeError('argument callback is required')
      ^
TypeError: argument callback is required
  at Function.handle (/Users/Filipe/Desktop/Smoothic/node_modules/router/index.js:156:11)
  at Server.router (/Users/Filipe/Desktop/Smoothic/node_modules/router/index.js:61:12)
  at Server.emit (events.js:98:17)
  at HTTPParser.parser.onIncoming (http.js:2108:12)
  at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
  at Socket.socket.ondata (http.js:1966:22)
 at TCP.onread (net.js:527:27)
roylines commented 9 years ago

I am seeing the same error

philipz commented 9 years ago

Me too~~~

chdileep2012 commented 9 years ago

I also got the same issue. It worked when I re-install node modules with sudo