nx: Cannot parse tsconfig.json: Unexpected token / in JSON at position 324
Please make sure you have read the submission guidelines before posting an issue
Prerequisites
Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- [x ] I am running the latest version
- I checked the documentation and found no answer
- I checked to make sure that this issue has not already been filed
- I’m reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)
Expected Behavior
Upgrade existing angular 8 cli project Please describe the behavior you are expecting
Current Behavior
Installed packages for tooling via npm. Two or more projects are using identical roots. Unable to determine project using current working directory. Using default workspace project instead. Two or more projects are using identical roots. Unable to determine project using current working directory. Using default workspace project instead. Renamed karma.conf.js -> apps\app\karma.conf.js Path: tsconfig.app.json does not exist Path: tsconfig.spec.json does not exist Renamed src -> apps\app\src Renamed e2e -> apps\app-e2e-e2e Cannot parse tsconfig.json: Unexpected token / in JSON at position 324 What is the current behavior?
Failure Information (for bugs)
Cannot parse tsconfig.json: Unexpected token / in JSON at position 324
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
TSCONFIG.JSON
{   "compileOnSave": false,   "compilerOptions": {     "importHelpers": true,     "module": "esnext",     "outDir": "./dist/out-tsc",     "sourceMap": true,     "declaration": false,     "moduleResolution": "node",     "emitDecoratorMetadata": true,     "experimentalDecorators": true,     "target": "es2015",     //"allowJs": true,     "typeRoots": ["node_modules/@types"],     "lib": ["es2017", "dom"]   },   "angularCompilerOptions": {     "preserveWhitespaces": false   } } 
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- ng add @nrwl/workspace
Context
Please provide any relevant information about your setup:
- version of Nx used 8.0.1
- version of Angular CLI used 8.0.0
- angular.jsonconfiguration- "configurations": { "production": { "optimization": true, "outputHashing": "all", "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ] }, "staging": { "optimization": true, "outputHashing": "all", "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.staging.ts" } ] } }
- version of Angular DevKit used “@angular-devkit/build-angular”: “~0.800.0”,
- 3rd-party libraries and their versions
"@angular/animations": "8.0.0", "@angular/cdk": "8.0.0", "@angular/common": "8.0.0", "@angular/compiler": "8.0.0", "@angular/core": "8.0.0", "@angular/flex-layout": "^8.0.0-beta.25", "@angular/forms": "8.0.0", "@angular/http": "^7.2.15", "@angular/material": "8.0.0", "@angular/platform-browser": "8.0.0", "@angular/platform-browser-dynamic": "8.0.0", "@angular/router": "8.0.0", "@ng-bootstrap/ng-bootstrap": "^4.1.1", "@ngrx/core": "1.2.0", "@ngrx/store": "6.0.1", "@ngrx/store-devtools": "^6.0.1", "@nrwl/workspace": "^8.1.0", "angular-font-awesome": "3.1.2", "bootstrap": "3.3.7", "core-js": "2.5.3", "font-awesome": "4.7.0", "jquery": "^3.4.1", "latest": "^0.2.0", "moment": "2.19.3", "ng2-nouislider": "1.7.6", "ngx-order-pipe": "2.0.1", "ngx-toastr": "^8.5.1", "nouislider": "10.1.0", "primeng": "5.0.2", "prismjs": "1.9.0", "quill": "1.3.4", "rxjs": "6.5.2", "rxjs-compat": "6.1.0", "stickybits": "3.3.2", "stickyfilljs": "2.0.3", "tslib": "^1.9.0", "zone.js": "~0.9.1"
- and most importantly - a use-case that fails
A minimal reproduce scenario using allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
Failure Logs
Please include any relevant log snippets or files here.
Other
Any other relevant information that will help us help you.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16
Commits related to this issue
- Remove trailing , in tsconfig https://github.com/nrwl/nx/issues/1462 — committed to samccone/bundle-buddy by samccone 4 years ago
- Remove trailing , in tsconfig https://github.com/nrwl/nx/issues/1462 — committed to phantom930/bundle-buddy by samccone 4 years ago
- Remove trailing , in tsconfig https://github.com/nrwl/nx/issues/1462 — committed to raika-dev/bundle-buddy by deleted user 4 years ago
I got this error when there was a comma ‘,’ at the end of the array list of ‘include’
I got this error when there was a comma ‘,’ at the end of the array list of ‘exclude’ of the tsconfig.json that is in the root files of the project
i fixed when remove the last comma.
Also, remove all comments in your tsconfig.json file.
Remove the last “,” in object paths in tsconfig.base.json
Change it:
"@models/*": ["apps/back-office/src/app/models/*"],For it:
"@models/*": ["apps/back-office/src/app/models/*"]The same issue. solved by https://jsonformatter.org/json-parser
for me it was to replace
“path”: { “@store/": [ "store/”] }
to
“path”: { “@store/": [ "store/”] },
Made it work for me 👍🏼
JUST THANK YOU!
u save my life man!
It smells like two bugs to me. Seems like tsc is more strict than it needs to be, and it also doesn’t give proper error messages in where the parsing went wrong. It seems a bit too easy to trigger the error. For me it happens with the default configuration:
rm tsconfig.jsontsc --initnpm run tscFunnily enough running
tscdirectly without npm seems to work