question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected character '#'

See original GitHub issue

I know it’s probably not the intended use, but I was trying to parse a node file with this and received this error. The node script is designed to be a command line tool, and espree is complaining about the shebang (#!/usr/bin/env node).

Stack Trace:

SyntaxError: Unexpected character '#'
    at Parser.instance.raise.instance.raiseRecoverable (node_modules/espree/espree.js:390:19)
    at Parser.pp.getTokenFromCode (node_modules/acorn/dist/acorn.js:2831:8)
    at Parser.pp.readToken (node_modules/acorn/dist/acorn.js:2526:15)
    at Parser.pp.nextToken (node_modules/acorn/dist/acorn.js:2518:71)
    at Parser.parse (node_modules/acorn/dist/acorn.js:1631:10)
    at Object.parse (node_modules/acorn/dist/acorn.js:885:44)
    at Object.parse (node_modules/espree/espree.js:715:21)

This is pretty easily fixed by stripping the first line out, but it requires an extra pre-processing step. It’d be nice to either throw a warning or ignore these (or both) without crashing the process.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
not-an-aardvarkcommented, Apr 9, 2019

It seems like we probably need the special logic anyway for parsers that don’t support the option.

2reactions
mdjermanoviccommented, Aug 26, 2022

This is now supported in espree v9.4.0 with ecmaVersion: 2023.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected Character - TV Tropes
They could be a One-Scene Wonder, someone who had succumbed to Chuck Cunningham Syndrome, simply a Living Prop, a Joke Character, or even...
Read more >
1:1 error Parsing error: Unexpected character ' ' - Stack Overflow
It look like UTF-8 BOM in the begin of your file. If you have notepad++ you can remove it by click to "Encoding"...
Read more >
Unexpected CHARACTER - Episode Support
"Unexpected CHARACTER". This error means the line of code before your character dialogue has an error. · "Unexpected CHARACTER or Scene change".
Read more >
ParseError: Unexpected character '@' #15832 - GitHub
I'm getting this parsing error (i.e., error Unexpected character '@' ParseError ) returned when running eslint --cache --fix .
Read more >
Unexpected character encountered while parsing value: S.
Unexpected character encountered while parsing value: S. ‎08-15-2022 01:50 AM. Hello everyone,. I have created a flow is to update my calendar invitation ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found