You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 12兼容@abacritt/angularx-social-login安装及相关问题解决

解决Angular v12与@abacritt/angularx-social-login的兼容问题

1. 安装适配Angular v12的指定版本

Angular v12仅兼容@abacritt/angularx-social-login的3.x.x系列版本,更高版本(4.x及以上)依赖Angular 13+,会引发依赖冲突。直接执行以下命令安装稳定兼容版:

npm install @abacritt/angularx-social-login@3.2.0

若之前安装过高版本,先卸载清理:

npm uninstall @abacritt/angularx-social-login

2. 修复asl-google-signin-button组件找不到的问题

  • 确保使用组件的模块中正确导入依赖并配置:
    import { SocialLoginModule, SocialAuthServiceConfig } from '@abacritt/angularx-social-login';
    import { GoogleLoginProvider } from '@abacritt/angularx-social-login/providers';
    
    @NgModule({
      imports: [SocialLoginModule],
      providers: [
        {
          provide: 'SocialAuthServiceConfig',
          useValue: {
            autoLogin: false,
            providers: [
              {
                id: GoogleLoginProvider.PROVIDER_ID,
                provider: new GoogleLoginProvider('你的谷歌OAuth客户端ID')
              }
            ]
          } as SocialAuthServiceConfig
        }
      ]
    })
    export class YourFeatureModule { }
    
  • 组件标签需严格使用官方定义的小写短横线格式:
    <asl-google-signin-button></asl-google-signin-button>
    

3. 验证安装结果

检查package.json中的依赖项,确认版本为3.x.x:

"@abacritt/angularx-social-login": "^3.2.0"

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 09:02:38