Angular CLI: 6.0.1
Node: 8.11.1
OS: win32 x64
Angular: 6.0.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, material, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.6.1
@angular-devkit/build-angular 0.6.1
@angular-devkit/build-ng-packagr 0.6.1
@angular-devkit/build-optimizer 0.6.1
@angular-devkit/core 0.6.1
@angular-devkit/schematics 0.6.1
@angular/flex-layout 6.0.0-beta.15
@ngtools/json-schema 1.1.0
@ngtools/webpack 6.0.1
@schematics/angular 0.6.1
@schematics/update 0.6.1
ng-packagr 3.0.0-rc.3
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
Unexpected token / in JSON at position 366
Here's my project's angular.json:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"client-app": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/public",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico",
{
"glob": "index.js",
"input": "server",
"output": "./../"
},
{
"glob": "package.json",
"input": "server",
"output": "./../"
},
{
"glob": "web.config",
"input": "server",
"output": "./../"
}
],
"styles": [
"./node_modules/devextreme/dist/css/dx.common.css",
"./node_modules/devextreme/dist/css/dx.light.css",
"src/styles.scss"
],
"scripts": []
},
"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"
}
]
},
"test": {
"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.test.ts"
}
]
},
"development": {
"sourceMap": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.ts"
}
]
},
"local": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.local.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "client-app:build",
"port": 44340
},
"configurations": {
"production": {
"browserTarget": "client-app:build:production"
},
"test": {
"browserTarget": "client-app:build:test"
},
"local": {
"browserTarget": "client-app:build:local"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "client-app:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"node_modules/devextreme/dist/css/dx.common.css",
"node_modules/devextreme/dist/css/dx.light.css",
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico",
{
"glob": "index.js",
"input": "server",
"output": "/"
},
{
"glob": "package.json",
"input": "server",
"output": "/"
},
{
"glob": "web.config",
"input": "server",
"output": "/"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
}
}
}
},
"client-app-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "client-app:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["e2e/tsconfig.e2e.json"],
"exclude": ["**/node_modules/**"]
}
}
}
}
},
"defaultProject": "client-app",
"schematics": {
"@schematics/angular:component": {
"prefix": "ccw",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "ccw"
}
}
}
and package.json:
{
"name": "client-app",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start-ng": "ng serve",
"start": "node src/server/index.js",
"build": "ng build",
"build-dev": "ng build -c development",
"build-local": "ng build -c local",
"build-test": "ng build --prod -c test",
"build-prod": "ng build --prod -c production",
"serve": "ng serve -c local -o",
"test": "ng test",
"test-single-headless": "ng test --watch=false --code-coverage --browsers=ChromeHeadless",
"lint": "ng lint",
"e2e": "ng e2e",
"sme": "./node_modules/.bin/source-map-explorer",
"postinstall": "del-cli node_modules/angular2-logger/app/core/*.ts"
},
"private": true,
"dependencies": {
"@angular-devkit/schematics": "^0.6.1",
"@angular/animations": "^6.0.1",
"@angular/cdk": "6.0.1",
"@angular/common": "^6.0.1",
"@angular/compiler": "^6.0.1",
"@angular/core": "^6.0.1",
"@angular/flex-layout": "^6.0.0-beta.15",
"@angular/forms": "^6.0.1",
"@angular/http": "^6.0.1",
"@angular/material": "^6.0.1",
"@angular/platform-browser": "^6.0.1",
"@angular/platform-browser-dynamic": "^6.0.1",
"@angular/router": "^6.0.1",
"@ngrx/store": "^5.2.0",
"@ngrx/store-devtools": "^5.2.0",
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^2.0.1",
"@nicky-lenaers/ngx-scroll-to": "^0.6.1",
"@types/applicationinsights-js": "^1.0.5",
"angular-split": "^1.0.0-rc.3",
"angular2-jwt": "^0.2.3",
"angular2-logger": "^0.7.0",
"applicationinsights-js": "^1.0.17",
"core-js": "^2.5.4",
"del-cli": "^1.1.0",
"devextreme": "^17.2.8",
"devextreme-angular": "^17.2.7",
"hammerjs": "^2.0.8",
"jwt-decode": "^2.2.0",
"msalx": "^0.1.2",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.1.0",
"rxjs-tslint": "^0.1.3",
"zone.js": "0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.6.1",
"@angular-devkit/build-ng-packagr": "^0.6.1",
"@angular/cli": "6.0.1",
"@angular/compiler-cli": "^6.0.1",
"@angular/language-service": "^6.0.1",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^10.0.8",
"codelyzer": "^4.3.0",
"jasmine": "^3.1.0",
"jasmine-core": "~3.1.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage": "^1.1.1",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "~1.1.0",
"karma-junit-reporter": "^1.2.0",
"karma-remap-coverage": "^0.1.4",
"karma-remap-istanbul": "^0.6.0",
"ng-packagr": "^3.0.0-rc.2",
"protractor": "^5.3.2",
"puppeteer": "^1.1.1",
"source-map-explorer": "^1.4.0",
"ts-node": "^6.0.3",
"tsickle": ">=0.25.5",
"tslib": "^1.7.1",
"tslint": "^5.10.0",
"typescript": "~2.7.2"
}
}
As given in this link (https://github.com/angular/angular-cli/wiki/stories-create-library), i updated the changes related to "baseUrl" in angular.json, src/tsconfig.app.json, src/tsconfig.spec.json and ./tsconfig.json but i am getting same error.
Error doesn't come in a new Angular 6 project. As a interim solution, i generated a new library from a new project and copy pasted the library directory into my project's folder, made a few relevant changes in angular.json, tsconfig.*.json and it worked.
It would have been good if the error message was a bit descriptive and meaningful.
I've had issues with 6.0.1 generating new projects and I've had to get back to 6.0.0
I am getting the same error in CLI v6.0.3 Any idea which json file the error is referring to?
Yes, it is referring to the angular.json file in your project. I was getting the exact same error. I had portions of my config file commented "//" out. It did not like the use of "//". Once i removed the "//", it worked just fine. Even if you are not using "//", there is a "/" or malformed code somewhere out of place in angular.json file.
@briangullo a comment in angular.json was my problem. Running ng serve with the comment in angular.json worked just fine so I kept it in there thinking it wasn't a problem.
Thanks for the help :)
There's a PR up for fixing this. Stay tuned.
God forbid they tell us the file to look at in the error. That would be way too hard
I have the same problem
ngular CLI: 6.0.8
Node: 8.9.1
OS: darwin x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-ng-packagr 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/json-schema 1.1.0
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
ng-packagr 3.0.3
rxjs 6.2.1
typescript 2.7.2
webpack 4.8.3
but the error is:
Unexpected token } in JSON at position 976
The wierd thing is that I have copy a project over with the same setup where it work but in this new one it does not.
I have updated locally schematic-command to get better error and here is stack for mine"
Unexpected token } in JSON at position 976
SyntaxError: Unexpected token } in JSON at position 976
at JSON.parse (<anonymous>)
at updateJsonFile (/projects/sourcing/AribaCoreUI/node_modules/@schematics/angular/library/index.js:20:27)
at /projects/sourcing/AribaCoreUI/node_modules/@schematics/angular/library/index.js:31:16
at MergeMapSubscriber.input.pipe.operators_1.mergeMap.inputTree [as project] (/projects/sourcing/AribaCoreUI/node_modules/@angular-devkit/schematics/src/rules/call.js:77:24)
at MergeMapSubscriber._tryNext (/projects/sourcing/AribaCoreUI/node_modules/@angular-devkit/schematics/node_modules/rxjs/internal/operators/mergeMap.js:65:27)
at MergeMapSubscriber._next (/projects/sourcing/AribaCoreUI/node_modules/@angular-devkit/schematics/node_modules/rxjs/internal/operators/mergeMap.js:55:18)
at MergeMapSubscriber.Subscriber.next (/projects/sourcing/AribaCoreUI/node_modules/@angular-devkit/schematics/node_modules/rxjs/internal/Subscriber.js:64:18)
at MergeMapSubscriber.notifyNext (/projects/sourcing/AribaCoreUI/node_modules/@angular-devkit/schematics/node_modules/rxjs/internal/operators/mergeMap.js:84:26)
at InnerSubscriber._next (/projects/sourcing/AribaCoreUI/node_modules/@angular-devkit/schematics/node_modules/rxjs/internal/InnerSubscriber.js:25:21)
at InnerSubscriber.Subscriber.next (/projects/sourcing/AribaCoreUI/node_modules/@angular-devkit/schematics/node_modules/rxjs/internal/Subscriber.js:64:18)
Found my problem it was with extra comma in tsconfig.json !
@hansl, when can we expect a fix on this? nobody is assigned to this defect.
This is likely a mix of two things;
We fixed those two in 6.1.0, so this should be fixed. If it is not, please file a new issue and provide a reproduction repository that we can look.
@fkolar same, had extra comma at the end of the paths array in ts.config. Took a long time to figure it out!
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._
Most helpful comment
Found my problem it was with extra comma in tsconfig.json !