Rooz Rooz - 1 year ago 183
JSON Question

Ionic platform add android throws Syntax error for package.json

I'm building an app with ionic. I've added ios to the platforms with no problem, but when I type

ionic platform add android
I get the following error:

Updated the hooks directory to have execute permissions Adding android project...
Creating Cordova project for the Android platform: Path:
platforms/android Package: com.ionicframework.conrem979285 Name:
ConRem Activity: MainActivity Android target: android-23 Android
project created with cordova-android@5.1.0 Running command:
"/Users/Roozbeh/Desktop/ConRem backup" add to body class:
platform-android Installing "cordova-plugin-app-event" for android
Installing "cordova-plugin-datepicker" for android Installing
"cordova-plugin-device" for android Installing
"de.appplant.cordova.plugin.local-notification" for android Dependent
plugin "cordova-plugin-device" already installed on android. Dependent
plugin "cordova-plugin-app-event" already installed on android.

Your support is needed. If you use the local-notification plugin please support us in order to ensure further development.

Thank you!

Saving platform to package.json file There was an error opening your
package.json file. SyntaxError: /Users/Roozbeh/Desktop/ConRem
backup/package.json: Unexpected token ] at Object.parse (native) at
Object.Module._extensions..json (module.js:450:27) at Module.load
(module.js:356:32) at Function.Module._load (module.js:311:12) at
Module.require (module.js:366:17) at require (module.js:385:17) at
at Object.getPackageJson
at Object.savePlatform
at /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:83:22

/Users/Roozbeh/Desktop/ConRem backup/package.json: Unexpected token ]
(CLI v1.7.14)

Here is my package.json file:

"name": "conrem",
"version": "1.1.1",
"description": "ConRem: An Ionic project",
"dependencies": {
"gulp": "^3.5.6",
"gulp-sass": "^2.0.4",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-rename": "^1.2.0"
"devDependencies": {
"bower": "^1.3.3",
"gulp-util": "^2.2.14",
"shelljs": "^0.3.0"
"cordovaPlugins": [
"cordovaPlatforms": []

Your system information:

Cordova CLI: 6.0.0 Gulp version: CLI version 3.9.0 Gulp local:

Ionic Version: 1.2.4 Ionic CLI Version: 1.7.14 Ionic App Lib Version:
0.7.0 ios-deploy version: 1.8.4 ios-sim version: 5.0.4 OS: Mac OS X El Capitan Node Version: v4.2.3 Xcode version: Xcode 7.2.1 Build
version 7C1002

Can someone please tell me what this syntax error is?


Answer Source

in your package.json there is one extra comma. I think that parsing is very strict and had the same issue before. There must not be a comma after the last item in an array.On the line


remove the comma at the end.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download