Error: Line 2: Unexpected reserved word #4648
Replies: 1 comment
-
Posted at 2018-06-20 by Wilberforce Please post all of your code. Where are you seeing the error message? The message appears to be coming from chrome - not from espruino Posted at 2018-06-20 by @gfwilliams It's possible the error you're hitting is because you've turned minification on and are using some ES6 features like arrow functions? But as @wilberforce says we'd need the full code - or at the very least some code that shows the error. Those two lines by themselves seem fine. Posted at 2018-06-20 by user91203 The error occurs when I click the button to send to Espruino in the IDE. I get a red popup message over the left-hand pane. I'm using the Chrome extension in this instance, if it makes a difference. @gfwilliams I don't think I'm using any fancy new features, but I'll check that. Posted at 2018-06-20 by user91203 Oh, I guess it might mean line 2 of the module. I didn't think of that... Posted at 2018-06-20 by @gfwilliams Ahh, that's a point! Neither did I :) I guess Posted at 2018-06-20 by user91203 Yeah. The module defines a Ahh. "Module minification" was switched to "Esprima". I've changed it to "No minification" and it works now. It would have been nice if the error message included a bit more information. eg Saying that it was line 2 of the module file. Is that possible? Thanks. Posted at 2018-06-21 by @gfwilliams
It shouldn't be at all - unfortunately the minifier its showing its age now. It might be time to ditch Esprima completely and move to the closure compiler (there's an open PR on GitHub that adds an offline version of closure - it's just quite a bit of code to include!).
Just done - next IDE update should have it in :) Posted at 2018-06-21 by user91203 Thanks! :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-06-19 by user91203
Hi. My code was working, but I've just upgraded to v1.99 on my Espruino WiFi, and now I'm getting the above error.
My code starts like this:
It definitely seems to be something to do with that second line, as I can load in other modules, but if I move the lines of code around the error message still stays
Error: Line 2
.Of course, I can rename my module if I need to. Seems like something weird is happening though. Any idea what?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions