Search code examples
jsonionic-frameworkngcordova

Parsing error in Ionic Config file. Please make sure it is valid JSON


All of a sudden, I'm getting this while trying to run ionic. What's wrong?

My Laptop Suddenly Crashes and when I restarted my System and Open Ionic in Code Editor it shows the Following Error:

Unable to parse Ionic Config file. Please make sure it is valid JSON (.ionic/ionic.config)

Caught exception:
 SyntaxError: Unexpected token
    at Object.parse (native)
    at Object.module.exports.load (C:\Users\BBytes\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\config.js:14:26)
    at Object.<anonymous> (C:\Users\BBytes\AppData\Roaming\npm\node_modules\ionic\lib\utils\stats.js:31:31)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\Users\BBytes\AppData\Roaming\npm\node_modules\ionic\lib\cli.js:3:18)

Mind letting us know? https://github.com/driftyco/ionic-cli/issues


Solution

  • After Some trial and Error:

    I think I have found the source of my problem!

    My C:/Users/{username}/.ionic/ionic.config file was corrupted when my pc crashed /or due to some other error.

    Weird that that file NEVER gets cleared when uninstalling ionic.

    Just Delete the file and when you run ionic serve it will create the file by default in the folder.