joomo
joomo

Reputation: 125

Angular app fails to run and displays invalid config error

I am building my angular app from the angular cli starter. The problem is being suggested in the error below.

C:\Users\Afropepe\Desktop\development\buy-ticket\node_modules\@angular\cli\models\config\config.js:76 throw new InvalidConfigError(common_tags_1.stripIndent ^ InvalidConfigError: Parsing 'C:\Users\Afropepe\Desktop\development\buy-ticket.angular-cli.json' failed. Ensure the file is valid JSON. Error: Unexpected token ] in JSON at position 535 at InvalidConfigError (C:\Users\Afropepe\Desktop\development\buy-ticket\node_modules\@angular\cli\models\config\config.js:11:9) at Function.fromConfigPath (C:\Users\Afropepe\Desktop\development\buy-ticket\node_modules\@angular\cli\models\config\config.js:76:19) at Function.fromProject (C:\Users\Afropepe\Desktop\development\buy-ticket\node_modules\@angular\cli\models\config.js:88:46) at Object. (C:\Users\Afropepe\Desktop\development\buy-ticket\node_modules\@angular\cli\commands\build.js:7:35) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17)

Upvotes: 2

Views: 2630

Answers (4)

JItendriya Sendha
JItendriya Sendha

Reputation: 31

angular-cli.json Content:

//"index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", "test": "test.ts",

Inside the .angular-cli.json/ angular-cli.json just remove ////"index": "index.html", because it won't considering as comment and throw some exception.

Correct Output:

  "main": "main.ts",
  "polyfills": "polyfills.ts",
  "test": "test.ts",

Upvotes: 1

Raju Lalli
Raju Lalli

Reputation: 11

I had same error, resolved by replacing with new angular-cli.json and reconfigure.

Upvotes: 0

jeer65
jeer65

Reputation: 51

Please ensure your file named ".angular-cli.json" contains JSON format, in my case I added some comments on the JSON file, and even when VS compile, this is not valid

  • "assets": [ "assets"],

  • //"index": "myindexfile.html",

  • "main": "main.ts",

    Please make sure your file is has a right JSON format

The error that I was getting is below:

  • \@angular\cli\models\config\config.js:89 throw new InvalidConfigError(common_tags_1.stripIndent ` ^

Upvotes: 3

SudoGrace
SudoGrace

Reputation: 179

I had some error, when tried to import in angular-cli.json in scripts file

 "../node_modules/tether/dist/js/tether.min.js" 

after

"../node_modules/bootstrap/dist/js/bootstrap.min.js"

So maybe this problem occurs when the one library needs to include another library before it.

Upvotes: 1

Related Questions