-
Notifications
You must be signed in to change notification settings - Fork 12k
Upgrading to angular 6 fails during angular-cli migration with unexpected token. #10396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A bit of comment-out-line-by-line debugging: The issue appears to be the
if I remove the subdirectory, it works like a charm. |
I'm also having the same issue for Clarity, which you can find our project at https://github.com/vmware/clarity/tree/website/latest. The angular-cli.json file is at https://github.com/vmware/clarity/blob/website/latest/.angular-cli.json.
I haven't been able to migrate even with the suggestion by @krotscheck. |
@hansl I think we already fixed this one, can you check? |
@krotscheck and @gnomeontherun can you try with |
@filipesilva I have the same problem with {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "client"
},
"packageManager": "yarn",
"apps": [
{
"root": "src/browser",
"outDir": "../../Build/Client/ui",
"assets": [],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"tsconfig": "tsconfig.app.json",
"prefix": "app",
"styles": [
"styles/app.scss"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"lint": [
{
"project": "src/browser/tsconfig.app.json",
"exclude": "**/node_modules/**"
}
],
"defaults": {
"styleExt": "scss",
"class": {
"spec": false
},
"component": {
"spec": false
},
"directive": {
"spec": false
},
"guard": {
"spec": false
},
"module": {
"spec": false
},
"pipe": {
"spec": false
},
"service": {
"spec": false
}
}
} The output
Versions
|
@filipesilva No luck from me, though likely for unrelated reasons. We just refactored into a
I suspect that issue's reported elsewhere. (Side note - yeah, I know |
also getting this with rc.10:
10:22 of the original file contains outDir, so I assume the numbers refer to the generated file. I will not provide the entire .angular-cli.json file here as it is very large and contains multiple apps, but perhaps a --verbose mode would be helpful in order to debug these issues? |
update: |
I can also confirm 6 final isn't working and get a very similar error
|
I can confirm that the issue still exists in 6.0 final |
I am getting a slightly different error (6.0 final)
I can't see how there is a problem at 0:0. The first character in |
@hansl perhaps this should be reopened? |
I'm getting the same as Swellenator in 6.0 final. My "root" = "src" Note: I had to delete a private npm package reference in order to get past a "not found" error but then I got this error. Probably unrelated but wanted to mention it in case. |
For |
Right, so I've done some digging around and found that it's not actually the writing of the angular.json file that fails.
Writing the buffer to console reveals the following string:
Which fails on the line However, when inspecting the actual file, it only has Commenting out that part from the chain, and the rest of the processes run by smoothly:
|
This is a BOM bug that I've been following for a while. Dupe of #10644. There is a similar bug (but much less fixable) for unicode characters in general, not sure how we're going to handle that one. For now, in most cases, PR angular/devkit#862 should fix this. |
I fixed the issue by converting most .json files (tsconfig, etc.) to UTF8, without BOM. |
All my files are UTF8 without BOM, but was still getting Invalid JSON character: \ at 9:66. { I've commented out the ten or so lines in updateSpecTsConfig that appends the polyfills to the files and I'm rocking and rolling again. |
@StrangeCargo74, the BOM only affects position 0,0 of the file. Your error is on line 9 at position 66 and you're missing a comma between "app-disco.test.ts" and "shared/other/polyfills.ts" |
Indeed cado1982. There are two problems here, one is with the BOM (error at line 0), and another (i think) is the polyfills setting being incorrectly copied across during the update (error at line 9ish) Just to be clear, my snippet is the console log of the buffer created in the updateSpecTsConfig function showing where the internal buffer was incorrect. I fixed it by commenting out the following lines in that function and copying the settings across manually. // const polyfills = app.polyfills || defaults.polyfills; |
Hey,
Please respond and share! |
I confirm the solution of @phl3x0r. PS: I'm using angular-cli 6.0.1 |
In my case, I had commented a script array entry with |
I had similar problem, updating Node from v6.10.2 to v10.1.0 did the trick. |
I fixed the issue by converting the following .json files (tsconfig, angular-cli.json, tslint) to UTF8, without BOM. |
I have followed https://update.angular.io/ and Updating karma configuration Anyone know? |
I was using visual studio code, i noticed the file encoding for |
My project tsconfig.json and tslint.json with UTF-8 and BOM so I choose UTF-8 and resolve it ago. |
Guys, I was having the same problem and managed to fix just leaving the tslint.json file as it was by default. To avoid tslint "errors" I had commented on some of the lines that he understands as error, but that are not ... (whitespace true - for example) Just correcting this, he did the update normally! Hope this helps someone else. Good luck !! |
You not only have to change tslint.json, you have to change also in folder "src" the tsconfigs , test.ts, . Any that is affected on this update |
I am also facing a similar issue. I've detailed it here, if someone can have a look please. |
I my case I was getting the following error:
The solution in my case could be found on this stackoverflow post |
trying create a jhipster project with angular 6 .when i run "ng serve" command ,i took error in below. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
6.0.0-rc.5
Repro steps
ng update @angular/cli --migrate-only --from=1
using the following .angular-cli.json file.
Observed behavior
Desired behavior
Successful app migration, or helpful error :)
The text was updated successfully, but these errors were encountered: