简体   繁体   中英

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/hooks/after_prepare/010_add_platform_class.js" "/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. https://github.com/katzer/cordova-plugin-local-notifications#supporting

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 Object.readInPackageJson (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/state.js:14:10) at Object.getPackageJson (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/state.js:23:25) at Object.savePlatform (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/state.js:368:27) 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": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard",
"cordova-plugin-datepicker",
],
"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?

Thanks

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

"cordova-plugin-datepicker",

remove the comma at the end.

Cordova 6不支持您的一个软件包。请检查每个软件包,它们在目标CLI版本6.0.0中都受支持。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM