Angular-cli: Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON

Created on 26 Apr 2017  路  10Comments  路  Source: angular/angular-cli

Getting below error when I go for ng -v after installing @angular/cli:
Node version: 7.9.0
npm version: 4.5.0

Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token u in JSON at position 22
InvalidConfigError: Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token u in JSON at position 22
at Function.fromConfigPath (C:\Users\Dilli Raja\AppData\Roaming\npm\node_modules\@angular\cli\models\config\config.js:74:19)
at Function.fromProject (C:\Users\Dilli Raja\AppData\Roaming\npm\node_modules\@angular\cli\models\config.js:91:46)
at Object. (C:\Users\Dilli Raja\AppData\Roaming\npm\node_modules\@angular\cli\commands\build.js:7:35)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)

Most helpful comment

@victormejia After deleting .angular-cli.json it working fine...Thanks for the support guys........

All 10 comments

{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "<%= htmlComponentName %>"
},
"apps": [
{
"root": "<%= sourceDir %>",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "<%= prefix %>",
"styles": [
"styles.<%= styleExt %>"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "<%= sourceDir %>/tsconfig.app.json"
},
{
"project": "<%= sourceDir %>/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "<%= styleExt %>",
"component": {}
}
}

above is .angular-cli.json which present globally in App data folder.. I even tried modifying the path "./node_modules/@angular/cli/lib/config/schema.json"

SyntaxError: Unexpected token u in JSON at position 22 suggests JSON is undefined.

I have the same issue. :-(
OS : Windows 7
Node Version 7.9.0

SyntaxError: Unexpected token u in JSON at position 22 suggests JSON is undefined.

@MRokas Did you find any discrepancy in the above JSON file which I commented?

@dilliraja-coax - Don't quote me, but I think one of variables used in <%= %> is undefined.

Sorry.. Just want to get help from you.. Thanks for the suggestion..

@victormejia After deleting .angular-cli.json it working fine...Thanks for the support guys........

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "@angular/cli"
npm ERR! node v6.11.2
npm ERR! npm v3.10.10
npm ERR! file C:\Users\Raj\AppData\Roaming\npm-cache\evp_bytestokey\1.0.3\package\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '\u0000' at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: C:\Users\Raj\AppData\Roaming\npm-cache\evp_bytestokey\1.0.3\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Raj\npm-debug.log

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