Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nowjs: [RangeError: Maximum call stack size exceeded]

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.

like image 300
timidboy Avatar asked May 31 '12 05:05

timidboy


2 Answers

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.

like image 199
Zlatko Avatar answered Oct 07 '22 16:10

Zlatko


Aadit, have you read the following:

Maximum Call Stack Size Exceeded During a setTimeout Call

Uncaught RangeError: Maximum call stack size exceeded, JavaScript

So, as you may see the problem seems to be arising because of the an improper use of stack sizes. If you haven't already you may read a bit more about this problem in detail here along with a possible solution: Maximum call stack size exceeded error

I don't think it has anything to do with the port, more with the methods/functions in the manner you're interacting/using the stack.

Then again, I may be wrong. ;D

like image 20
Rohan Durve Avatar answered Oct 07 '22 16:10

Rohan Durve