You need to enable JavaScript to run this app. Ionic Angular 导入GooglePlus报错:类型GooglePlus不存在'ɵmod'属性
优惠活动
大模型
产品
解决方案
定价
更多

Ionic Angular 导入GooglePlus报错:类型GooglePlus不存在'ɵmod'属性

报错根因

你将GooglePlus原生服务错误添加到了Angular模块的imports数组中,imports数组仅接受带@NgModule装饰器的Angular模块类,GooglePlus是可注入的服务类,本身不是模块,因此缺少模块必备的ɵmod属性,触发此报错。

修复步骤

  1. 修改tab1/tab1.module.ts文件:
    • 删除imports数组中的GooglePlus项
    • 在@NgModule配置中新增providers数组,将GooglePlus加入该数组
      修改后的代码如下:
...
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
  ],
  declarations: [Tab1Page, GoogleSignupComponent],
  providers: [GooglePlus]
})
export class Tab1PageModule { }
  1. 额外验证点:
    你当前使用的依赖版本互相适配,不需要调整版本:
  • Angular 11 对应适配 @ionic-native 5.x 版本,你使用的@ionic-native/google-plus@5.33.0符合要求
  • cordova-plugin-googleplus@8.5.2和上述原生封装包版本匹配
  • 注意该插件为原生能力,仅能在真机/模拟器环境运行,浏览器调试会触发其他原生相关报错,属于正常情况。

内容的提问来源于stack exchange,提问作者Evan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.20 08:06:09