Vscode-react-native: Debugger fails with SyntaxError: Unexpected token <

Created on 12 Dec 2017  路  8Comments  路  Source: microsoft/vscode-react-native

Actual Behavior

On running the debugger for iOS the debugger worker fails to run printing this error:
SyntaxError: Unexpected token <

This is similar to this issue #580

Expected Behavior

To run the react-native app on the simulator with vscode debugger attached.

Software versions

  • React-Native VS Code extension version: 0.5.7
  • VSCode version: 1.18.1
  • OS platform and version: macOS 10.13.2
  • NodeJS version: 9.1.0
  • React Native version: 0.51.0

Outputs (Include if relevant)

  • Output of the Debug Console (View -> Toggle Debug Console):
SyntaxError: Unexpected token <
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:152:10)
    at Module._compile (module.js:605:28)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Function.Module.runMain (module.js:682:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:613:3

  • Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):

screen shot 2017-12-12 at 8 13 27 pm

debuggerWorker.js has HTML markup inserted every time I run the debugger:

screen shot 2017-12-12 at 8 22 16 pm

bug need-more-info need-repro triaged waiting-for-clarification

All 8 comments

Is it react-native init project?
Also please paste Output of the React-Native output channel (View -> Toggle Output -> Select React-Native in ListBox).

It is a react-native init project.
The output of the React-Native output channel:

screen shot 2017-12-12 at 8 30 17 pm

When I downgraded react-native to version 0.49.5 the problem disappeared.
Advised by the following thread:
https://github.com/Microsoft/vscode/issues/37734

However I need to use the latest react-native for my project so this isn't a viable solution.

I had this exact problem after updating from 0.49.5 to 0.51.0. Turning debugger off and on again fixed it.

P.S. I don't use VSCode, so I don't think this issue caused by this plugin, I got here via Google search.

@redlock
Sorry for delay.
Looks like you have run packager outside the vscode:
[Info] packager is already running.
Could you please check it and close packager if it's true. And try to run debug ios again from vscode.
Thanks!

Hi @redlock, please let us know if the issue still has place for you and if you have a chance to take a look at the message above.

I have same error in both cases: when packager started from within vscode and when I connect to external packager. This behaviour was checked few times and I had same result. Later I try to give more details.

Hey guys, I'm closing this for now, please feel free to reopen or create new one if the issue still has place for you. Please also provide us as much info as possible so we would be able to reproduce and fix this.

Was this page helpful?
0 / 5 - 0 ratings