Nowjs: [RangeError: Maximum call stack size exceeded]

timidboy picture timidboy · May 31, 2012 · Viewed 23.7k times · Source

When I start the server on port 8080 it doesn't give me an error, but when I am trying to browse the http://localhost:8080/nowjs/now.js the server raises an error:

[RangeError: Maximum call stack size exceeded]
undefined

I tried the same with socket.io and it worked fine.

Answer

Zlatko picture Zlatko · Nov 19, 2012

Hmm, if now.js uses date.js, maybe your issue lies here. What the link says is that date.js tries to set a toString to Date prototype, but when toString is already defined, you get the circular reference mentioned in the other answers.

Basically, they say that in date.js, you change

Date.prototype._toString=Date.prototype.toString

to

if(Date.prototype._toString==undefined) {Date.prototype._toString=Date.prototype.toString;}

I hope it will help someone. It helped me.