Ionic serve could not start how do i solve the problem

Unable to parse Ionic Config file. Please make sure it is valid JSON (.ionic/ionic.config)
Caught exception:
SyntaxError: Unexpected token in JSON at position 0
at Object.parse (native)
at Object.load (C:\Users\phil\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\config.js:14:26)
at Object. (C:\Users\phil\AppData\Roaming\npm\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?

Post your output of ionic info please. Thanks.

One possible solution:

i resolved the issue thanks. now in ionic 2 in case i want a constant baseurl where do i place. ionic

Are you trying to use your constant baseurl everywhere in your app? If so, create a provider and inject wherever you need it.

exactly that what i want

How did you solve the problem? Please post a bit of information so that future users having the same problem may not only find the problem but also a solution by googling. Thanks.

1 Like

deleted the file located at C:\Users\phil.ionic\ionic.config the i run ionic serve .it will be re-created again

1 Like

If you want to use a global constant a use it every where in the app. for my projet I’ve created a static class name constant see below

export  class GlobalsConstants{
    static urlServer:string = "myBaseUrl";


whenever I need my base Url I just call my class.

Thank you. but i have created a provider and it was working just okay, i was thinking there is a more simpler way to solve it.
import { Injectable } from ‘@angular/core’;
import {Http, Headers} from ‘@angular/http’;
import ‘rxjs/add/operator/map’;

Generated class for the MyService provider.

for more info o n providers and Angular 2 DI.

export class SettingService {
baseUrl: String;

constructor() {

then i inject it to the ts that i wish to use baseurl

I thinks the simplest way is what I just wrote above. a static class which embedded all your constant. no need to inject it. kiss (keep it simple and stupid) :slight_smile:

I access it like like this.myproviderService.baseUrl any where

gonna try that but either way it works:thumbsup:

Angular 2’s Opaque Token’s were designed exactly for this. To have an app config (which you can provide a base URL) which can be injected anywhere.

Thx this is interesting. Learning something new every day.