Ionic 5: compile failed - An accessor cannot be declared in an ambient context

Viewed 413

I am trying to ionic serve my application but I got this error

[ng] ERROR in node_modules/@angular/common/common.d.ts:1309:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1309     set klass(value: string);
[ng]              ~~~~~
[ng] node_modules/@angular/common/common.d.ts:1310:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1310     set ngClass(value: string | string[] | Set<string> | {
[ng]              ~~~~~~~
[ng] node_modules/@angular/common/common.d.ts:1507:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1507     set ngForOf(ngForOf: U & NgIterable<T> | undefined | null);
[ng]              ~~~~~~~

[ng] node_modules/@angular/common/common.d.ts:1809:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1809     set ngPlural(value: number);
[ng]              ~~~~~~~~
[ng] node_modules/@angular/common/common.d.ts:1884:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1884     set ngStyle(values: {
[ng]              ~~~~~~~
[ng] node_modules/@angular/common/common.d.ts:1965:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1965     set ngSwitch(newValue: any);
[ng]              ~~~~~~~~
[ng] node_modules/@angular/common/common.d.ts:2304:18 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2304     abstract get href(): string;
[ng]                       ~~~~
[ng] node_modules/@angular/common/common.d.ts:2305:18 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2305     abstract get protocol(): string;
[ng]                       ~~~~~~~~
[ng] node_modules/@angular/common/common.d.ts:2306:18 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2306     abstract get hostname(): string;
[ng]                       ~~~~~~~~
[ng] node_modules/@angular/common/common.d.ts:2307:18 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2307     abstract get port(): string;
[ng]                       ~~~~
[ng] node_modules/@angular/common/common.d.ts:2308:18 - error TS1086: An accessor cannot be declared in an ambient context.
[
[ng]             ~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:615:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 615     get valueChanges(): Observable<any> | null;
[ng]             ~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:621:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 621     get path(): string[] | null;
[ng]             ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:637:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 637     get validator(): ValidatorFn | null;
[ng]             ~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:643:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 643     get asyncValidator(): AsyncValidatorFn | null;
[ng]             ~~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:749:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 749     get control(): FormGroup;
[ng]             ~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:754:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 754     get path(): string[];
[ng]             ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:759:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 759     get formDirective(): Form | null;
[ng]             ~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:928:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 928     get formDirective(): Form | null;
[ng]             ~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:933:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 933     get path(): string[] | null;
[ng]             ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1162:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1162     set email(value: boolean | string);
[ng]              ~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1352:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1352     get length(): number;
[ng]              ~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1572:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1572     get control(): FormArray;
[ng]              ~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1577:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1577     get formDirective(): FormGroupDirective | null;
[ng]              ~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1583:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1583     get path(): string[];
[ng]              ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1898:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1898     set isDisabled(isDisabled: boolean);
[ng]              ~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1911:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1911     get path(): string[];
[ng]              ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1916:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1916     get control(): FormControl;
[ng]              ~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:1983:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 1983     set isDisabled(isDisabled: boolean);
[ng]              ~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2005:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2005     get path(): string[];
[ng]              ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2010:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2010     get formDirective(): any;
[ng]              ~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2359:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2359     get formDirective(): Form;
[ng]              ~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2364:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2364     get control(): FormGroup;
[ng]              ~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2370:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2370     get path(): string[];
[ng]              ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2846:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2846     get formDirective(): Form;
[ng]              ~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2851:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2851     get control(): FormGroup;
[ng]              ~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2857:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2857     get path(): string[];
[ng]              ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:2862:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 2862     get controls(): {
[ng]              ~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:3094:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 3094     get path(): string[];
[ng]              ~~~~
[ng] node_modules/@angular/forms/forms.d.ts:3099:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 3099     get formDirective(): any;
[ng]              ~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:3179:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 3179     set ngValue(value: any);
[ng]              ~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:3185:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 3185     set value(value: any);
[ng]              ~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:3492:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 3492     get required(): boolean | string;
[ng]              ~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:3493:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 3493     set required(value: boolean | string);
[ng]              ~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:3584:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 3584     set compareWith(fn: (o1: any, o2: any) => boolean);
[ng]              ~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:3668:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 3668     set compareWith(fn: (o1: any, o2: any) => boolean);
[ng]              ~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4088:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4088     get ngClassUntouched(): boolean;
[ng]              ~~~~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4089:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4089     get ngClassTouched(): boolean;
[ng]              ~~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4090:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4090     get ngClassPristine(): boolean;
[ng]              ~~~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4091:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4091     get ngClassDirty(): boolean;
[ng]              ~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4092:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4092     get ngClassValid(): boolean;
[ng]              ~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4093:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4093     get ngClassInvalid(): boolean;
[ng]              ~~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4094:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4094     get ngClassPending(): boolean;
[ng]              ~~~~~~~~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4220:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4220     set ngValue(value: any);
[ng]              ~~~~~~~
[ng] node_modules/@angular/forms/forms.d.ts:4226:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 4226     set value(value: any);
[ng]              ~~~~~
[ng] node_modules/ng-socket-io/dist/src/socket-io.module.d.ts:8:45 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
[ng] 8     static forRoot(config: SocketIoConfig): ModuleWithProviders;
[ng]                                               ~~~~~~~~~~~~~~~~~~~
[ng] src/app/app.module.ts:16:36 - error TS2307: Cannot find module 'nativescript-angular/nativescript.module'.
[ng] 16 import { NativeScriptModule } from "nativescript-angular/nativescript.module";
[ng]                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] src/app/app.module.ts:17:41 - error TS2307: Cannot find module 'nativescript-angular/forms'.
[ng] 17 import { NativeScriptFormsModule } from "nativescript-angular/forms";
[ng]                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] Date: 2020-11-26T22:51:14.882Z - Hash: 863161f086fbc0b396f4 - Time: 4145ms
[ng] i 「wdm」: Failed to compile.

I assume I may have some versionning error, that's why I give some details about my config:

+-- @ionic/cli@6.12.2
+-- cordova@9.0.0
+-- cordova-res@0.15.2
+-- ionic@5.4.16
`-- native-run@1.0.0

Ionic:

   Ionic CLI                     : 6.12.2 (C:\Users\backs\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 5.0.4
   @angular-devkit/build-angular : 0.803.24
   @angular-devkit/schematics    : 8.3.25
   @angular/cli                  : 11.0.2
   @ionic/angular-toolkit        : 2.2.0

I tried many things to resolved it but I don't want to make worst the situation. Do you have an idea to resolve the problem ? I think maybe it's because of versioning of ionic or angular with packages

Thanks in advance

0 Answers
Related