Uncaught SyntaxError: Unexpected token * in now.js (line 380)

273 views
Skip to first unread message

Craig Aschbrenner

unread,
May 18, 2011, 12:17:57 AM5/18/11
to no...@googlegroups.com
I'm attempting to replicate the helloworld example using the Drupal CMS on the LAMP stack with NowJS on the same server.  I have a node server setup listening to port 80 and then using http-proxy to route Drupal requests to apache on port 9000.  So far the proxy is working well.

When I load the Drupal rendered page (helloworld) I noticed an error popup in chrome using inspect element.  The error is: Uncaught SyntaxError: Unexpected token *  (found in now.js on line 380)

Line 380 (from now.js): socket = new io.Socket('**SERVER**', {port: **PORT**});

Eric Zhang

unread,
May 18, 2011, 12:21:06 AM5/18/11
to no...@googlegroups.com
Hey Craig,

NowJS automatically parses and renders the server and port for the server when you access now.js from 

http://yourserver:port/nowjs/now.js

Important note: now.js as loaded from the server, is not the same as now.js in github. It is in fact nowUtil.js prepended to now.js


So whatever port and host you are running nowjs on, go to
http://yourserver:port/nowjs/now.js and download that file.

Host that file as your client lib in your LAMP stack and you'll be good to go.


Eric

Craig Aschbrenner

unread,
May 18, 2011, 9:20:02 AM5/18/11
to no...@googlegroups.com
That did the trick!

I have to proxy .js requests through to Drupal so I wasn't able to access now.js through http://yourserver:port/nowjs/now.js.  I had missed the FAQ item about nowUtils.js so as you mentioned I had placed the wrong script file on my client.  Once I copied over nowUtil.js and referenced that instead that particular error has gone away.

Now I just need to figure out why I'm getting "Uncaught ReferenceError: now is not defined".  :-)  I'll do more digging on that and post up another issue if I can't get that resolved.

Thanks Eric!

Amey Sakhadeo

unread,
Mar 22, 2012, 4:38:07 AM3/22/12
to no...@googlegroups.com
Hey. 
I am facing the same issue.

Did you find out the solution?

Thanks.
Reply all
Reply to author
Forward
0 new messages