Angular-cli: ng serve doesn't work with chrome ("unexpected token <")

Created on 22 Jun 2017  路  6Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.1.0
node: 8.1.2
os: darwin x64
@angular/animations: 4.2.4
@angular/common: 4.2.4
@angular/compiler: 4.2.4
@angular/core: 4.2.4
@angular/forms: 4.2.4
@angular/http: 4.2.4
@angular/platform-browser: 4.2.4
@angular/platform-browser-dynamic: 4.2.4
@angular/router: 4.2.4
@angular/cli: 1.1.0
@angular/compiler-cli: 4.2.4
@angular/language-service: 4.2.4

macOS (10.12.5)
Chrome version 59.0.3071.109 (64-bit)

Repro steps.

using angular cli

ng new any
cd any
ng serve

in chrome browser: error ('Uncaught SyntaxError: Unexpected token <'), localhost served as type 'script' not 'document'

Desired functionality.

It should serve index.html as document and work correctly, instead the app doesn't load. This error only happens in chrome, in safari works correctly

repro steps RFC / discussion / question

All 6 comments

You might have a problem with an extension in chrome actually. I have that exact chrome build and everything runs fine. I'm on windows though.

Yeah it works in windows actually, only on my Mac it doesn't work. I have tried uninstalling and reinstalling chrome, I'll try with angular-cli.

Edit: I removed and reinstalled ng-cli but still doesn't work, however I found that ng serve --prod works correctly

@edo-vi did you try in Chrome's Incognito Mode? Theoretically you have extensions turned off in it (unless you specified to run particular extension in Incognito)

Yeah it works! I didn't know it could be an extension problem, I removed every extension and cleared the cache and now works!
Thanks for your time, I guess you can close this now ;)

@edo-vi thanks for confirming the solution. You should be able to close the issue as well since you opened it :)

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings