I'm trying to update Angular 9 app to Angular 10 and get an error:
> Removing "Solution Style" TypeScript configuration file support.
× Migration failed: Failed to parse "tsconfig.json" as JSON AST Object. PropertyNameExpected at location: 571.
See "C:\Users\F11K\AppData\Local\Temp\ng-T8Bgiu\angular-errors.log" for further details.
That's the content of the log file:
[error] Error: Failed to parse "tsconfig.json" as JSON AST Object. PropertyNameExpected at location: 571.
at JSONFile.get JsonAst [as JsonAst] (C:\Users\F11K\Documents\server\angular-client\node_modules\@schematics\angular\utility\json-file.js:33:19)
at JSONFile.get (C:\Users\F11K\Documents\server\angular-client\node_modules\@schematics\angular\utility\json-file.js:41:61)
at C:\Users\F11K\Documents\server\angular-client\node_modules\@schematics\angular\migrations\update-10\remove-solution-style-tsconfig.js:33:71
at MergeMapSubscriber.project (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\rules\call.js:75:24)
at MergeMapSubscriber._tryNext (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:67:27)
at MergeMapSubscriber._next (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:57:18)
at MergeMapSubscriber.Subscriber.next (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:66:18)
at Observable._subscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeToArray.js:5:20)
at Observable._trySubscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:44:25)
at Observable.subscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:30:22)
at MergeMapOperator.call (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:37:23)
at Observable.subscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:25:31)
at MapOperator.call (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\map.js:32:23)
at Observable.subscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:25:31)
at Object.innerSubscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\innerSubscribe.js:102:23)
at MergeMapSubscriber._innerSub (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:80:50)
[error] Error: Failed to parse "tsconfig.json" as JSON AST Object. PropertyNameExpected at location: 571.
at JSONFile.get JsonAst [as JsonAst] (C:\Users\F11K\Documents\server\angular-client\node_modules\@schematics\angular\utility\json-file.js:33:19)
at JSONFile.get (C:\Users\F11K\Documents\server\angular-client\node_modules\@schematics\angular\utility\json-file.js:41:61)
at C:\Users\F11K\Documents\server\angular-client\node_modules\@schematics\angular\migrations\update-10\remove-solution-style-tsconfig.js:33:71
at MergeMapSubscriber.project (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\rules\call.js:75:24)
at MergeMapSubscriber._tryNext (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:67:27)
at MergeMapSubscriber._next (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:57:18)
at MergeMapSubscriber.Subscriber.next (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:66:18)
at Observable._subscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeToArray.js:5:20)
at Observable._trySubscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:44:25)
at Observable.subscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:30:22)
at MergeMapOperator.call (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:37:23)
at Observable.subscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:25:31)
at MapOperator.call (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\map.js:32:23)
at Observable.subscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:25:31)
at Object.innerSubscribe (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\innerSubscribe.js:102:23)
at MergeMapSubscriber._innerSub (C:\Users\F11K\AppData\Local\Temp\angular-cli-packages-dD436h\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:80:50)
I've looked into the tsconfig.json
and manually adjusted: "module": "esnext"
=> "module": "es2020"
but it didn't work.
Log confusing me as it's not gets me right place where error occurs, could you please help? Thanks a lot.
Content of tsconfig.json
:
{
"compileOnSave": false,
"compilerOptions": {
"downlevelIteration": true,
"incremental": true,
"tsBuildInfoFile": ".tsbuildinfo",
"module": "es2020",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types",
"tests"
],
"lib": [
"es2018",
"dom"
],
"baseUrl": "src",
}
}
Removing an unnecessary "," worked for me. In yours the problem could be solved by removing the "," after "baseUrl": "src"
Angular "ng update" have an integrated JSON linter and if you have a JSON with a comma or with a weird format or something it will throw an error. You can use jsonlint.com provided by @heretic-monkey and fix your JSON file first.
PS: I tried --force, -migrateOnly nothing worked, I just had a comma at end of my 'lib' array
{ "lib": [ "es2017", "dom" ], }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With