jingo icon indicating copy to clipboard operation
jingo copied to clipboard

get illegal token error

Open hajika opened this issue 8 years ago • 10 comments

I suddenly get this error when opening jingo:

SyntaxError: Unexpected token ILLEGAL
    at Function (native)
    at wrap (/home/user/jingo/node_modules/pug/node_modules/pug-runtime/wrap.js:8:30)
    at Object.exports.compile (/home/user/jingo/node_modules/pug/lib/index.js:263:7)
    at handleTemplateCache (/home/user/jingo/node_modules/pug/lib/index.js:216:25)
    at Object.exports.renderFile (/home/user/jingo/node_modules/pug/lib/index.js:418:10)
    at Object.exports.renderFile (/home/user/jingo/node_modules/pug/lib/index.js:408:21)
    at View.exports.__express [as engine] (/home/user/jingo/node_modules/pug/lib/index.js:455:11)
    at View.render (/home/user/jingo/node_modules/express/lib/view.js:128:8)
    at tryRender (/home/user/jingo/node_modules/express/lib/application.js:640:10)
    at EventEmitter.render (/home/user/jingo/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/home/user/jingo/node_modules/express/lib/response.js:966:7)
    at ServerResponse.res.render (/home/user/jingo/node_modules/express-flash/lib/express-flash.js:29:16)
    at /home/user/jingo/lib/app.js:199:9
    at Layer.handle_error (/home/user/jingo/node_modules/express/lib/router/layer.js:71:5)
    at trim_prefix (/home/user/jingo/node_modules/express/lib/router/index.js:315:13)
    at /home/user/jingo/node_modules/express/lib/router/index.js:284:7

I already completely reinstalled jingo and created a new repo, but the error is still there. I cant imagine why?! As far as I know, that can happen when there is an invisible character in JS code, but how suddenly and why its not working after reinstallation?

hajika avatar May 17 '17 15:05 hajika

@hajika ouch, this sounds bad. Can you give me a bit more details? When is that you get that? On starting jingo, on loading the first page or somewhere else?

thanks!

claudioc avatar May 17 '17 18:05 claudioc

I get this on opening any page. I checked the wrap.js in the meantime, and it actually complains about the last + (that is the sign in wrap.js:8:30). When I remove the last two +, it will complain about the other plus. Strange.

var runtime = require('./');

module.exports = wrap;
function wrap(template, templateName) {
  templateName = templateName || 'template';
  return Function('pug',
    template + '\n' +
    'return ' + templateName + ';'
  )(runtime); 
}

It might be because of the template variable, I put it in a console.log() and got a very long output with actual code, I guess thats not intended? What should be in the template var? I will attach the output here to give you a hint (everything between the xxx):

jingolog.txt

hajika avatar May 19 '17 18:05 hajika

Thanks, but this is still not enough: can you please send me also your config.yaml? What is your server (or workstation) configuration? Windows maybe?

claudioc avatar May 19 '17 21:05 claudioc

CentOs 6

As I said, I completely reinstalled the whole thing, in the config.yaml I only changed the port and the repository path, anything else is like in the default. I also initiated a new git repo.

hajika avatar May 19 '17 21:05 hajika

So I still encounter that problem with the master branch, but not with the v1.7.3, so I hope this will vanish with the next release :)

hajika avatar May 20 '17 07:05 hajika

It must have something to do with the 1.8.0 release, then (there were big changes there), but I cannot reproduce it on OSX and Ubuntu at the moment.

One of the templates is probably broken somehow but I can't understand where the problem is.

claudioc avatar May 20 '17 12:05 claudioc

In the meanwhile try the current version (1.8.1)

claudioc avatar May 20 '17 12:05 claudioc

Can you also please tell me you node js version?

claudioc avatar May 20 '17 12:05 claudioc

I just tried the v1.8.2 and the error appears again. Node version is v0.12.9, but I can change I easily if there is any benefit in it..

hajika avatar May 24 '17 08:05 hajika

I am pretty sure Node 0.x is not supported anymore, or not supported very well at least.

Please use any of the LTS (since you are updating, go for 6.x)

Thanks

claudioc avatar May 28 '17 11:05 claudioc