ionic-team / ionic-cli

The Ionic command-line interface
MIT License
1.99k stars 653 forks source link

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

Closed dragonfly95 closed 6 years ago

dragonfly95 commented 8 years ago

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)

lisaiceland commented 8 years ago

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

lisaiceland commented 8 years ago

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 node-uuid@1.4.7: 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 ├── cordova@6.4.0 └── ionic@2.1.12

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.

matejamateusz commented 7 years ago

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

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

is the right answer thanks ;)

finalxcode commented 7 years ago

thanks

seokochin commented 7 years ago

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

ramoncardena commented 7 years ago

@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!

thiagopa commented 7 years ago

Thanks @seokochin This worked for me as well

zeeshananjumjunaidi commented 7 years ago

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"
    }
  ]
}
udha19 commented 6 years ago

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

HeshamEG commented 6 years ago

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

Vajidbaba commented 6 years ago

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

srinivasGit commented 6 years ago

@Vajidbaba thanks its working for me