Ionic-native: @ionic-native/contacts - Module parse failed: Identifier 'checkAvailability' has already been declared

Created on 15 Aug 2018  Â·  11Comments  Â·  Source: ionic-team/ionic-native

[ng] ERROR in ./node_modules/@ionic-native/contacts/ngx/index.js
[ng] Module parse failed: Identifier 'checkAvailability' has already been declared (17:128)
[ng] You may need an appropriate loader to handle this file type.
[ng] |     return c > 3 && r && Object.defineProperty(target, key, r), r;
[ng] | };
[ng] | import { IonicNativePlugin, checkAvailability, cordovaInstance, instanceAvailability, instancePropertyGet, instancePropertySet, checkAvailability, getPromise } from '@ionic-native/core';
[ng] | var Contact = /** @class */ (function () {
[ng] |     function Contact() {
[ng] ℹ 「wdm」: Failed to compile.

Bug Report

Ionic Info

Ionic:

   ionic (Ionic CLI)          : 4.0.0-rc.13 (/usr/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.2
   @angular-devkit/core       : 0.7.2
   @angular-devkit/schematics : 0.7.2
   @angular/cli               : 6.1.2
   @ionic/ng-toolkit          : 1.0.6
   @ionic/schematics-angular  : 1.0.4

Cordova:

   cordova (Cordova CLI) : not installed
   Cordova Platforms     : none

System:

   NodeJS : v10.8.0 (/usr/bin/node)
   npm    : 6.2.0
   OS     : Linux 4.15

Environment:

   ANDROID_HOME : not set

Describe the Bug
I receive following error since update to "@ionic/angular": "4.0.0-beta.2" & "@ionic-native/contacts": "5.0.0-beta.14", "@ionic-native/core": "5.0.0-beta.14"

Steps to Reproduce
Steps to reproduce the behavior:

  1. edit package.json: "@ionic/angular": "4.0.0-beta.2", "@ionic-native/contacts": "5.0.0-beta.14", "@ionic-native/core": "5.0.0-beta.14"
  2. npm install
  3. ionic serve

Expected Behavior
Just start Ionic App.

bug

Most helpful comment

same here in ionic-native/contacts-5.0.0-beta.21

All 11 comments

for me i have remove checkAvailability from node_modules/@ionic-native/contacts/ngx/index.js file line 17.
because it was write two time.

I can confirm Mayank5510's comment. After adjusting the index.js file (rename second, duplicated parameter), everything works as expected.

This is still an issue in the npm package beta-5.0.0-beta.17

This issue still persist in ionic-native/contacts-5.0.0-beta.21

same here in ionic-native/contacts-5.0.0-beta.21

Hi, I'm trying to find multiple contacts inside a foreach loop.
When I want to find the 2nd time, the contacts plugin fails with the error "create() failed, expecting Object, String given".
This is the line of the plugin that's failing:
The field "result[i]" has an "OK" string instead of a Contact.
I checked that the problem was related to "system availability", but I don't know how to fix it.
currently running "cordova-plugin-contacts": "^3.0.1" and "@ionic-native/contacts": "^4.15.0",
image

@ezequielbarnes I got same issue.
what is solution?
image

I can confirm Mayank5510's comment. After adjusting the index.js file (rename second, duplicated parameter), everything works as expected.

hello, should we update library directly yet?

Hi!, I've just waited a few seconds after trying again.
If you use the Promises correctly, you won't have any problem.
You have to set up a flag that blocks all attempts of using the Contacts
library until the last request has finished (async await it's a really good
way to achieve this)

Hope it helps!

On Tue, 27 Nov 2018 at 06:23, MobileWebPro notifications@github.com wrote:

@ezequielbarnes https://github.com/ezequielbarnes I got same issue.
what is solution?
[image: image]
https://user-images.githubusercontent.com/5020713/49071511-2d335380-f23f-11e8-805d-1928d57caecf.png

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ionic-team/ionic-native/issues/2642#issuecomment-441986439,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALzYGs6k9cAwvWXlXMjlII0Ptu9CLVvHks5uzQR_gaJpZM4V-Xxz
.

@ezequielbarnes I got same issue.
what is solution?
image

btw, your problem seems to be that you have the "checkAvailability" import twice. I don't think it's the same problem that I had.

This is still an issue in beta.22 - A revert to beta.15 fixes the problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danbucholtz picture danbucholtz  Â·  3Comments

ihadeed picture ihadeed  Â·  4Comments

ghost picture ghost  Â·  3Comments

sabariferin picture sabariferin  Â·  4Comments

wwallace picture wwallace  Â·  4Comments