Search code examples
angularionic-frameworkionic5google-plus-signin

Ionic Angular - Error: Type GooglePlus does not have 'ɵmod' property


I am unable to import GooglePlus without getting this errors.

console errors

ERROR Error: Uncaught (in promise): Error: Type GooglePlus does not have 'ɵmod' property. getNgModuleDef@http://localhost:8100/vendor.js:57098:15 recurse@http://localhost:8100/vendor.js:81227:35 recurse@http://localhost:8100/vendor.js:81238:24

tab1/tab1.module.ts

...
import { Tab1PageRoutingModule } from './tab1-routing.module';
import { GoogleSignupComponent } from './google-signup/google-signup.component';
import { GooglePlus } from '@ionic-native/google-plus/ngx';

@NgModule({
  imports: [
    ...
    Tab1PageRoutingModule,
    GooglePlus
  ],
  declarations: [Tab1Page, GoogleSignupComponent],
})
export class Tab1PageModule { }

tab1/google-signup/google-signup.component.ts

...
import { GooglePlus } from '@ionic-native/google-plus/ngx';
@Component({
  selector: 'app-google-signup',
  templateUrl: './google-signup.component.html',
  styleUrls: ['./google-signup.component.scss'],
})
export class GoogleSignupComponent implements OnInit {

  constructor(private googlePlus: GooglePlus) { }

  ngOnInit() { }

  public google() {
    console.log('google signup');
    this.googlePlus.login({})
      .then(res => console.log(res))
      .catch(err => console.error(err));
  }
  ...
}

I am using:

  • angular 11
  • "@ionic-native/google-plus": "^5.33.0"
  • "cordova-plugin-googleplus": "^8.5.2",

Solution

  • You are trying to import GooglePlus in your ngModule imports. There is no need for this. Docs

    EDIT:

    Sometimes you need to add a Plugin as provider to your ngModule. You could try this:

    @NgModule({
    imports: [...],
    providers: [GooglePlus],
    ...