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 Token { in browser console on fresh new yeoman+fountainJS projects

See original GitHub issue

Issue details

I’m using Yeoman with FountainJS to generate a new project. As soon as it finish assembling it, I simply run the classic npm run serve. It finishes without errors but then I get this error in chrome browser console:

Uncaught SyntaxError: Unexpected token }

The error is reported to be generated from browser-sync-client.js?v=2.23.5:89. My doubt is if the issue is actually in browserSync or in something else built by fountainJS package. I tried building an angularJS (simple landing page) and angular (todo mcv) project but the error persist with both cases even if they’re different framework/languages/source.

Steps to reproduce/test case

  1. Install Yeoman
  2. Add fountainJS
  3. Generate a project (keep it simple, I didn’t continuous integration support for example)
  4. run npm run serve
  5. Open the browser to the newly running webserver
  6. Open the console

Please specify which version of Browsersync, node and npm you’re running

From package,json:

  • “browser-sync”: “^2.18.8”,
  • “browser-sync-spa”: “^1.0.3”,

Others:

  • Node v9.3.0
  • Npm 5.6.0

Affected platforms

  • windows

Browsersync use-case

  • API
  • GULP

for all other use-cases, (gulp, grunt etc), please show us exactly how you’re using Browsersync

From gulpfile.js:

const browserSync = require('browser-sync');

// [...]

function reloadBrowserSync(cb) {
  browserSync.reload();
  cb();
}

function watch(done) {
  gulp.watch(conf.path.tmp('index.html'), reloadBrowserSync);
  done();
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
shakyShanecommented, Jan 24, 2018

@johanberonius @theCrius please try browser-sync@2.23.6

1reaction
johanberoniuscommented, Jan 24, 2018

Yes, it works. Thanks for the quick fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

what's this in chrome console " Uncaught SyntaxError ...
The error is fired, because the loaded file is tried to parse to JavaScript. {...} is parsed as a code block, the quoted...
Read more >
JavaScript console "Uncaught SyntaxError: Unexpected Token {"
During this process I notice that the console is showing the same old code despite multiple revisions.
Read more >
Uncaught SyntaxError: Unexpected token } · Issue #45 - GitHub
When using browser-sync-client.js?v=2.23.3:89 & Chrome latest. I get the following error in the browser console.
Read more >
[.Net] Uncaught SyntaxError: Unexpected token '<' - Agents
Hi, we got a JS error on our website (https://my.intuiface.com ) due to newrelic script injection from the agent : (we are using...
Read more >
[SOLVED] Unity 2020 WebGL Doesn't work Uncaught ...
Uncaught SyntaxError: Invalid or unexpected token ... but I also created a fresh empty project with 2020.2.0a7 and got the same result.
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