ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

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

Open dragonfly95 opened this issue 10 years ago • 12 comments

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/

Note: for build related issues you can open up an issue on the ionic-app-scripts repo

https://github.com/driftyco/ionic-app-scripts

Short description of the problem:

Unable to parse Ionic Config file. Please make sure it is valid JSON (.ionic/ionic.config) Caught exception: SyntaxError: Unexpected end of input at Object.parse (native) at Object.module.exports.load (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/config.js:14:26) at Object. (/usr/local/lib/node_modules/ionic/lib/utils/stats.js:31:31) at Module._compile (module.js:434:26) at Object.Module._extensions..js (module.js:452:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (/usr/local/lib/node_modules/ionic/lib/cli.js:3:18)

What behavior are you expecting?

Steps to reproduce: 1. 2. 3.

insert any relevant code between the above and below backticks

Post the output of ionic info below please

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

dragonfly95 avatar Nov 20 '16 16:11 dragonfly95

I'm getting this same issue this very morning ;-(

lisaiceland avatar Nov 21 '16 12:11 lisaiceland

cleaned cache uninstalled node re-installed node 6.9.1 LTS npm config get prefix and made sure /usr/local

chown'd permissions to make sure: sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} sudo npm install -g ionic cordova

RUN & MESSAGE: $ npm install -g ionic cordova npm WARN deprecated [email protected]: use uuid module instead /usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova /usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic /usr/local/lib ├── [email protected] └── [email protected]

STILL GET ERROR when: ionic info or try to build with ionic start...

MESSAGE: ionic info

Unable to parse Ionic Config file. Please make sure it is valid JSON (.ionic/ionic.config) Caught exception: SyntaxError: Unexpected end of JSON input at Object.parse (native) at Object.load (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/config.js:14:26) at Object. (/usr/local/lib/node_modules/ionic/lib/utils/stats.js:31:31) 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) at require (internal/module.js:20:19)

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

UPDATE: I even tried: brew uninstall node brew install node

UPDATE: I have also tried yarn CLI could not get it to work.

I have also tried to make sure all my permissions on npm on my dev is OK with new build and installs and re-installs and re-builds of my dev machine multiple times. Ref: https://docs.npmjs.com/getting-started/fixing-npm-permissions

then... npm install -g ionic cordova ...nope still not working. OK, I gotta just stop and drop out of Ionic 2 for a while.Too many changes to the framework and breaking my builds almost twice weekly. Killing me. Anyway, it's back to latest build of Android Studio for the next few days I guess until we get some solid resolutions to these build issues.

** #UPDATE 11/21/2016: Houston, we have a go woohoo!** Ughhhh....kool finally can go back to work with Ionic 2! OK: Found the fix here: https://forum.ionicframework.com/t/ionic-command-not-work/19452/5You'll want to edit the file, .eg: sudo nano /usr/local/lib/node_modules/ionic-app-lib/lib/config.js

or $ cd /usr/local/lib/node_modules/ionic-app-lib/lib/ $ atom . or $code . or whatever. Open the config.js file in the dir

then....change line 7 as it is if you install ionic@latest as of 11/21/2016: CONFIG_FILE: '.ionic/ionic.config', To have a slash after the dot:

CONFIG_FILE: './ionic/ionic.config',

Then save the file, and try running an ionic command: ionic info or whatever Ionic CLI command you need to run! Done.

lisaiceland avatar Nov 21 '16 14:11 lisaiceland

CONFIG_FILE: '.ionic/ionic.config', To have a slash after the dot:

CONFIG_FILE: './ionic/ionic.config',

is the right answer thanks ;)

matejamateusz avatar Dec 23 '16 14:12 matejamateusz

thanks

finalxcode avatar Dec 26 '16 08:12 finalxcode

Just delete {user}/.ionic/ionic.config.json and run ionic serve It will be fixed. Delete this from terminal.

seokochin avatar Feb 04 '17 04:02 seokochin

@seokochin solution worked like a charm!

I also did everything before...uninstalling node, and so. But just deleting ionic.config was the solution. Keep in mind that the file is in your home folder, not in the folder where you have your app.

As the problem appeared suddenly, I was not convinced by the config_file solution, as I didn't modified anything before the error. So I was thinking more in some corrupted file problem, and @seokochin solution was more logical in that case.

Thanks!

ramoncardena avatar Feb 26 '17 22:02 ramoncardena

Thanks @seokochin This worked for me as well

thipag avatar Mar 24 '17 16:03 thipag

Comments were causing problem for me. it needs to be pure simple json structure like following:

{
  "name": "ionic3-sample",
  "app_id": "",
  "type": "ionic-angular",
  "integrations": {
    "cordova": {}
  },
  "proxies": [
    { 
      "path": "/JSON",
      "proxyUrl": "http://192.168.1.123/JSON"
    }
  ]
}

zeeshananjumjunaidi avatar Nov 16 '17 07:11 zeeshananjumjunaidi

thanks a lot @seokochin you save my time a lot..

udha19 avatar Jan 15 '18 08:01 udha19

the easy way just delete file config.json located in C:.ionic\config.json then ionic serve again and solved :dango:

HeshamEG avatar Feb 03 '18 13:02 HeshamEG

Goto this path- C:/Users/{username}/.ionic find file (ionic.config) and delete that file.

ghost avatar Feb 08 '18 10:02 ghost

@Vajidbaba thanks its working for me

srinivasGit avatar Aug 21 '18 09:08 srinivasGit