Closed AmaniKhalifa closed 6 years ago
This is my package.json file:
{ "dependencies": { "@angular/common": "^2.0.0-rc.1", "@angular/compiler": "^2.0.0-rc.1", "@angular/core": "^2.0.0-rc.1", "@angular/http": "^2.0.0-rc.1", "@angular/platform-browser": "^2.0.0-rc.1", "@angular/platform-browser-dynamic": "^2.0.0-rc.1", "@angular/router": "^2.0.0-rc.1", "es6-shim": "^0.35.0", "ionic-angular": "2.0.0-beta.9", "ionic-native": "^1.2.4", "ionicons": "3.0.0", "ng2-timeago": "^1.0.5", "reflect-metadata": "^0.1.3", "rxjs": "5.0.0-beta.6", "zone.js": "^0.6.12" }, "devDependencies": { "del": "2.2.0", "gulp": "3.9.1", "gulp-watch": "4.3.5", "ionic-gulp-browserify-typescript": "^1.1.0", "ionic-gulp-fonts-copy": "^1.0.0", "ionic-gulp-html-copy": "^1.0.0", "ionic-gulp-sass-build": "^1.0.0", "ionic-gulp-scripts-copy": "^2.0.0", "ng2-translate": "^2.1.0", "run-sequence": "1.1.5" }, "name": "egyfoss_mobile", "description": "egyfoss_mobile: An Ionic project", "cordovaPlugins": [ "cordova-plugin-device", "cordova-plugin-console", "cordova-plugin-whitelist", "cordova-plugin-statusbar", "ionic-plugin-keyboard", "cordova-plugin-device@~1.1.2", "cordova-plugin-console@~1.0.3", "cordova-plugin-whitelist@~1.2.2", "cordova-plugin-statusbar@~2.1.3", "ionic-plugin-keyboard@~2.2.0", "cordova-plugin-inappbrowser", "cordova-plugin-x-toast", "cordova-plugin-splashscreen@3.2", "cordova-plugin-splashscreen@3.2.0", "cordova-plugin-crosswalk-webview", { "variables": { "API_KEY_FOR_ANDROID": "xxx", "API_KEY_FOR_IOS": "xxx" }, "locator": "https://github.com/phonegap-googlemaps-plugin/cordova-plugin-googlemaps", "id": "cordova-plugin-googlemaps" }, { "variables": { "API_KEY_FOR_ANDROID": "xxx", "API_KEY_FOR_IOS": "xxx" }, "locator": "https://bitbucket.org/nightstomp/cordova-plugin-googlemaps-sdk.git", "id": "com.googlemaps.ios" }, "cordova-plugin-facebook4", "cordova-plugin-facebook4@~1.7.1", "cordova-plugin-network-information", "cordova-plugin-network-information@~1.2.1" ], "cordovaPlatforms": [ "android" ] }
I ran into the same problem with the phonegap-plugin-push. The reason is, that the plugins require a variable when added (e.g. --variable APP_ID="123456789" when adding the Facebook plugin). I guess ionic restore does not set this variable and so the "Caught exception: undefined" happens. This is problematic, because more and more plugins use the --variable parameter.
Try to replace the plugin "cordova-plugin-facebook4", in your package.json with the following:
{
"variables": {
"APP_ID": "123456789",
"APP_NAME:": "myApplication"
},
"locator": "cordova-plugin-facebook4",
"id": "cordova-plugin-facebook4"
},
@JStumpp do I have to do the same for all plugins? Getting the same error
@gangachris This is only necessary for the plugins that use variables. Unfortunately the "ionic restore" command (or cordova underneath) adds the plugins that are defined in json again as a plain string without the variables. So after running "ionic restore" you have to remove the added strings again from your package.json.
I'm curious about any progress (or identification of a bug) on this issue.
A project I'm working on has several plugins defined as objects (as they require variables
to properly install) as opposed to string locators.
As @JStumpp noted, any plugin that is added as an object is duplicated at the end of the cordovaPlugins
section after doing an ionic state restore
(or build
) as strings. In addition, I'm also seeing string locators duplicated as strings with specific version numbers at the end of this section.
Having multiple people work on the project at a given time, it's simply unacceptable to tell them to always do a git checkout
of their package.json/config.xml after a state restore
or initial build
. Given a new dev checks out the codebase and does an npm i
and ionic state restore
|build
the package.json/config.xml is immediately marked as unstaged.
Cheers~
Hi everyone I faced with this issue, too I tried to update cordova, ionicm Java JDK and then I tried to install plugin one by one and found that some plugins have wrong id / links in my package.json, also I found that my "locator" was wrong I changed them to correct links and it solved the problem
Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.
Thank you for using Ionic!
Hello I'm getting this error always after the cordova-plugin-facebook4 plugin :
any idea what is this?