Angular-cli: ERROR in Invalid or unexpected token

Created on 27 Nov 2018  路  4Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

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

Command (mark with an x)

- [ ] new
- [X] build
- [X] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Angular CLI: 7.1.0
Node: 9.11.1
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.11.0
@angular-devkit/core         7.1.0
@angular-devkit/schematics   7.1.0
@schematics/angular          7.1.0
@schematics/update           0.11.0
rxjs                         6.3.3
typescript                   3.1.6

Repro steps

Copy a text with hidden special characters, Like LS

The log given by the failure

ERROR in Invalid or unexpected token

Desired functionality

Give more details about the error, for example the template and line number (if that's possible)

Mention any other details that might be useful

I've copied a text from a design tool called Figma into my template After running --aot a very unclear error message occurs, which took me hours to find the exact error.
Copying the specific tekst to Notepad ++ showed me the hidden text.

https://www.figma.com/file/Y1Qoirjshd3SjoeITfqdKlVL/Untitled?node-id=0%3A1

ls

core & compiler low broken triage #1 bufix

Most helpful comment

I have created a simple repo.
https://github.com/richardsengers/angular-cli-13064

If you run the command

ng build --aot

The error pops up.

All 4 comments

Can you expand on the repro steps please?

Where should the text be copied to, and what command (I guess ng build --aot`?) should be ran to see that error?

I have created a simple repo.
https://github.com/richardsengers/angular-cli-13064

If you run the command

ng build --aot

The error pops up.

I tested this on the latest version of the Angular CLI (v9.1.7). Your repo doesn't seem to build for me as I got node-gyp errors. I make a new project and copy-pasted your snippet in and verified that it contains the LS character per the "UTF-8 (hex)" specification of 0xE2 0x80 0xA8 per this link.

Nx6r7ebv2pD

This is able to build successfully and load the page (though it just ignores the LS character).

douglasparker@basilisk (~/Source/fixit-test)
[20-05-26 15:58:53]$ ng serve

chunk {main} main.js, main.js.map (main) 10.3 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 141 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 12.4 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.92 MB [initial] [rendered]
Date: 2020-05-26T22:59:09.989Z - Hash: 1b0d1c902436ca9349ce - Time: 7079ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.

Screenshot from 2020-05-26 16-23-17

This was probably fixed with updates to the Ivy compiler, so I'm closing this issue. If you still see this on latest Angular CLI then please re-open.

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

Related issues

IngvarKofoed picture IngvarKofoed  路  3Comments

sysmat picture sysmat  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

daBishMan picture daBishMan  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments