angular - Ionic Angular GooglePlus:NgModule 的提供程序无效
问题描述
我正在尝试将GooglePlus登录集成到带有 Angular 应用程序的 Ionic。
错误:
ERROR 错误:未捕获(承诺中):错误:NgModule 'UsersModule' 的提供程序无效 - 只允许提供 Provider 和 Type 的实例,得到:[Keyboard, ?[object Object]?]
users.module.ts
...
import { GooglePlus } from '@ionic-native/google-plus';
@NgModule({
declarations: [
...
],
entryComponents: [
...
],
imports: [
...
],
exports: [
...
],
providers: [
...,
GooglePlus
]
})
export class UsersModule { }
解决方案
您需要将导入路径更改为:
import { GooglePlus } from '@ionic-native/google-plus/ngx';
您可能会看到构建错误:
An unhandled exception occurred: The target entry-point "@ionic-native/google-plus" has missing dependencies:
- @ionic-native/core
只需安装@ionic-native/core
依赖项,您就可以开始使用了。
npm install @ionic-native/core
最后一个想法,如果您在使用该 Cordova 插件时遇到问题,另一种选择是@codetrix-studio/capacitor-google-auth
. Simon Grimm 有一个很棒的博客How to add Capacitor Google Sign In to your Ionic App,其中描述了让 Google auth 工作所需的所有步骤。
推荐阅读
- c# - 仅 4 位正则表达式模式/组匹配日期和斜线
- python - 如何从每个子组的pandas DataFrame中统一采样n行
- php - 根据 WP 编码标准清洁和消毒 php 代码
- javascript - Asp .Net Core 缓存选择 ajax 请求
- docker - 如何在 CoreOS 虚拟机上运行 Cassandra?
- time - gnuplot 事件频率随时间变化
- linux - 如何使用更新的模块在 Yocto 中重建图像
- c# - 不同类型的类字典
- javascript - 仅使用 setinterval 更新 div
- ios - 在 SwiftUI 中获取 List 的内容偏移量