Issues with Ionic Serve

The weirdest part of this error is that I currently have two projects, one works, and the other doesn’t.

The one that works was one of ionic’s pre-built example apps, the sidemenu one I believe. The project that doesn’t work is one I purchased off of CodeCanyon to learn from.

For the project that doesn’t work, I can run an ionic build and an ionic emulate, just not the ionic serve.

Here's the error:

Error occured [Error: There was an error loading your ionic.project file: Unexpected token }]

TypeError: is not a function
    at (/usr/local/lib/node_modules/ionic/lib/ionic/serve.js:38:18)
    at (/usr/local/lib/node_modules/ionic/lib/cli.js:96:32)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/bin/ionic:9:10)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:134:18)
    at node.js:961:3 is not a function (CLI v1.7.1)

I’ve checked bower.json, config.xml, gulpfile.js, ionic.project, and package.json for unclosed {}, but there aren’t any.

Anyone have any ideas?

Your system information:

Cordova CLI: 5.3.3
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.0
Ionic Version: 1.0.0
Ionic CLI Version: 1.7.1
Ionic App Lib Version: 0.5.1-beta.0
ios-deploy version: 1.8.2 
ios-sim version: 5.0.2 
OS: Mac OS X El Capitan
Node Version: v4.2.1
Xcode version: Xcode 7.0.1 Build version 7A1001

The problem seems you have some where in your code miss-match of brackets “}”. I think it is very helpful if you check all of your Angular Js Files for Error. Let me know if it doesn’t help!

1 Like

That’s what I originally thought, but it’s weird that the error is being shown in the Ionic core.

I did check some files, but I didn’t dive into any of the Angular files, just the various config files.

I’ll look into Angular files, hopefully that’s the fix. Which would mean there’s a bug in the files I purchased, which would be annoying.

Oh well, at least I have a new direction to investigate - thanks! :smile:

So far all of the files have the appropriate number of brackets. Finding mismatching brackets would be… a pain to say the least.

Just keep digging…

I had the exact same error as you,

the problem for me was inside ionic.project file

It was:

“name”: “myApp”,
“app_id”: “”
“watchPatterns”: [


There was a comma missing after app_id.

“name”: “myApp”,
“app_id”: “”,
“watchPatterns”: [



Thanks,I resolved this problem

how did you resolve ?
i am getting the following error

TypeError: undefined is not a function
at (C:\Users\abhijeet\AppData\Roaming\npm\node_modules
at (C:\Users\abhijeet\AppData\Roaming\npm\node_modules\ionic\lib
at Object. (C:\Users\abhijeet\AppData\Roaming\npm\node_modules\io
at Module._compile (module.js:460:26)
at Object.Module._extensions…js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

undefined is not a function (CLI v1.7.14)

Your system information:

Cordova CLI: 6.1.1
Ionic Version: 1.2.4-nightly-1917
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Windows 8.1
Node Version: v0.12.7