简体   繁体   English

离子平台添加android引发package.json的语法错误

[英]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: 我已经毫无问题地将ios添加到了平台,但是当我键入ionic platform add android ,出现以下错误:

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. 更新了hooks目录以具有执行权限添加android项目...为Android平台创建Cordova项目:路径:platform / android软件包:com.ionicframework.conrem979285名称:ConRem活动:MainActivity Android目标:android-23使用以下项创建的Android项目cordova-android@5.1.0运行命令:“ / Users / Roozbeh / Desktop / ConRem backup / hooks / after_prepare / 010_add_platform_class.js”“” / Users / Roozbeh / Desktop / ConRem backup“添加到主体类:platform-android安装”适用于android的cordova-plugin-app-event安装适用于android的“ cordova-plugin-datepicker”适用于android的安装“ cordova-plugin-device”安装适用于android的“ de.appplant.cordova.plugin.local-notification”依赖插件“ cordova -plugin-device”已安装在android上。 Dependent plugin "cordova-plugin-app-event" already installed on android. 依赖插件“ cordova-plugin-app-event”已安装在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 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. 将平台保存到package.json文件中打开package.json文件时出错。 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 SyntaxError:/ Users / Roozbeh / Desktop / ConRem backup / package.json:在Object.parse(本机)在Object.Module._extensions..json(模块.js:450:27)在Module.load(模块.js:356:32)在Function.Module._load(module.js:311:12)在Module.require(module.js:366:17)在require(module.js:385:17)在Object.readInPackageJson (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/state.js:14:10)在Object.getPackageJson(/ usr / local / lib / node_modules / ionic / node_modules / ionic-位于以下位置的Object.savePlatform(/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/state.js:368:27)处的app-lib / lib / state.js:23:25) 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) / Users / Roozbeh / Desktop / ConRem backup / package.json:意外令牌](CLI v1.7.14)

Here is my package.json file: 这是我的package.json文件:

{
"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: Cordova CLI:6.0.0 Gulp版本:CLI版本3.9.0 Gulp本地版本:
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 Ionic版本:1.2.4 Ionic CLI版本:1.7.14 Ionic App Lib版本:0.7.0 ios部署版本:1.8.4 ios-sim版本:5.0.4 OS:Mac OS X El Capitan节点版本:v4.2.3 Xcode版本:Xcode 7.2.1 Build版本7C1002

Can someone please tell me what this syntax error is? 有人可以告诉我这个语法错误是什么吗?

Thanks 谢谢

in your package.json there is one extra comma. package.json还有一个逗号。 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中都受支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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