命名空间 'ReCaptcha' 没有导出成员 X
Namespace 'ReCaptcha' has no exported member X
我正在尝试在我的 Angular 应用程序中使用 ReCaptcha,不幸的是,我在导入 ReCaptcha 模块后遇到以下错误。
Error: node_modules/ng-recaptcha/lib/recaptcha-loader.service.d.ts:23:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
23 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaLoaderService, [null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-loader.service.d.ts:24:22 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectableDeclaration'.
24 static ɵprov: i0.ɵɵInjectableDeclaration<RecaptchaLoaderService>;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.component.d.ts:58:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
58 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaComponent, [null, null, null, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.component.d.ts:59:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵComponentDeclaration'.
59 static ɵcmp: i0.ɵɵComponentDeclaration<RecaptchaComponent, "re-captcha", ["reCaptcha"], { "id": "id"; "siteKey": "siteKey"; "theme": "theme"; "type": "type"; "size": "size"; "tabIndex": "tabIndex"; "badge": "badge"; "errorMode": "errorMode"; }, { "resolved": "resolved"; "error": "error"; }, never, never>;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-common.module.d.ts:4:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
4 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaCommonModule, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-common.module.d.ts:5:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
5 static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaCommonModule, [typeof i1.RecaptchaComponent], never, [typeof i1.RecaptchaComponent]>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-common.module.d.ts:6:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
6 static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaCommonModule>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.module.d.ts:5:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
5 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaModule, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.module.d.ts:6:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
6 static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaModule, never, [typeof i1.RecaptchaCommonModule], [typeof i2.RecaptchaComponent]>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.module.d.ts:7:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
7 static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaModule>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.module.d.ts:3:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
3 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaV3Module, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.module.d.ts:4:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
4 static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaV3Module, never, never, never>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.module.d.ts:5:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
5 static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaV3Module>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.service.d.ts:76:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
76 static ɵfac: i0.ɵɵFactoryDeclaration<ReCaptchaV3Service, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.service.d.ts:77:22 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectableDeclaration'.
77 static ɵprov: i0.ɵɵInjectableDeclaration<ReCaptchaV3Service>;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-value-accessor.directive.d.ts:16:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
16 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaValueAccessorDirective, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-value-accessor.directive.d.ts:17:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵDirectiveDeclaration'.
17 static ɵdir: i0.ɵɵDirectiveDeclaration<RecaptchaValueAccessorDirective, "re-captcha[formControlName],re-captcha[formControl],re-captcha[ngModel]", never, {}, {}, never>; ...
我已使用 npm install ng-recaptcha --save
将 recaptcha 模块添加到我的 angular 项目中,并使用 import { RecaptchaModule} from 'ng-recaptcha';
将其导入到我的 app.module.ts
中
使用过的版本:
节点:14.15.4
npm:6.14.10
ng-recaptcha: 9.0
运行 苹果 m1 芯片
在这种情况下,您需要升级 Angular 或降级您的 recaptcha。使用 npm i ngx-captcha@9.0.1
,它是使用 Angular 6 及更高版本实现的。并按照此视频中给出的说明进行操作 https://www.youtube.com/watch?v=AYznH6MBXM8
我正在使用 angular 11
,我降级了我的 recaptcha 版本并且它有效。
尝试在包 JSON 和 运行 npm install
上替换为 ng-recaptcha": "8.0.1
我正在尝试在我的 Angular 应用程序中使用 ReCaptcha,不幸的是,我在导入 ReCaptcha 模块后遇到以下错误。
Error: node_modules/ng-recaptcha/lib/recaptcha-loader.service.d.ts:23:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
23 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaLoaderService, [null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-loader.service.d.ts:24:22 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectableDeclaration'.
24 static ɵprov: i0.ɵɵInjectableDeclaration<RecaptchaLoaderService>;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.component.d.ts:58:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
58 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaComponent, [null, null, null, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.component.d.ts:59:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵComponentDeclaration'.
59 static ɵcmp: i0.ɵɵComponentDeclaration<RecaptchaComponent, "re-captcha", ["reCaptcha"], { "id": "id"; "siteKey": "siteKey"; "theme": "theme"; "type": "type"; "size": "size"; "tabIndex": "tabIndex"; "badge": "badge"; "errorMode": "errorMode"; }, { "resolved": "resolved"; "error": "error"; }, never, never>;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-common.module.d.ts:4:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
4 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaCommonModule, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-common.module.d.ts:5:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
5 static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaCommonModule, [typeof i1.RecaptchaComponent], never, [typeof i1.RecaptchaComponent]>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-common.module.d.ts:6:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
6 static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaCommonModule>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.module.d.ts:5:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
5 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaModule, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.module.d.ts:6:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
6 static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaModule, never, [typeof i1.RecaptchaCommonModule], [typeof i2.RecaptchaComponent]>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha.module.d.ts:7:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
7 static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaModule>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.module.d.ts:3:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
3 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaV3Module, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.module.d.ts:4:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
4 static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaV3Module, never, never, never>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.module.d.ts:5:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
5 static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaV3Module>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.service.d.ts:76:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
76 static ɵfac: i0.ɵɵFactoryDeclaration<ReCaptchaV3Service, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-v3.service.d.ts:77:22 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectableDeclaration'.
77 static ɵprov: i0.ɵɵInjectableDeclaration<ReCaptchaV3Service>;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-value-accessor.directive.d.ts:16:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
16 static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaValueAccessorDirective, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/ng-recaptcha/lib/recaptcha-value-accessor.directive.d.ts:17:21 - error TS2694: Namespace '"/Users/ahmadafrakhteh/WebstormProjects/Influentic/node_modules/@angular/core/core"' has no exported member 'ɵɵDirectiveDeclaration'.
17 static ɵdir: i0.ɵɵDirectiveDeclaration<RecaptchaValueAccessorDirective, "re-captcha[formControlName],re-captcha[formControl],re-captcha[ngModel]", never, {}, {}, never>; ...
我已使用 npm install ng-recaptcha --save
将 recaptcha 模块添加到我的 angular 项目中,并使用 import { RecaptchaModule} from 'ng-recaptcha';
app.module.ts
中
使用过的版本: 节点:14.15.4 npm:6.14.10 ng-recaptcha: 9.0
运行 苹果 m1 芯片
在这种情况下,您需要升级 Angular 或降级您的 recaptcha。使用 npm i ngx-captcha@9.0.1
,它是使用 Angular 6 及更高版本实现的。并按照此视频中给出的说明进行操作 https://www.youtube.com/watch?v=AYznH6MBXM8
我正在使用 angular 11
,我降级了我的 recaptcha 版本并且它有效。
尝试在包 JSON 和 运行 npm install
ng-recaptcha": "8.0.1