node.jsangularnpmngshopizer

Angular app install and run: Error TS2694: Namespace..has no exported member 'ɵɵFactoryDeclaration


Trying to build and run this angular project. After building the project, with npm i I got some warning, no errors. After running ng serve -o I get the below errors. And on browser, I get Cannot GET / Initial Total zero 0 bytes

https://github.com/shopizer-ecommerce/shopizer-admin

za:shopizer-admin za$ npm start

> shopizer-admin@ start /Users/za/project/shopizer-admin
> ng serve

✔ Browser application bundle generation complete.

Initial Chunk Files | Names         |    Size
main.js             | main          | 0 bytes
polyfills.js        | polyfills     | 0 bytes
runtime.js          | runtime       | 0 bytes
scripts.js          | scripts       | 0 bytes
styles.css          | styles        | 0 bytes
vendor.js           | vendor        | 0 bytes

                    | Initial Total | 0 bytes

Build at: 2023-10-24T05:57:24.925Z - Hash: db03cf5f3ac89adee553 - Time: 92316ms

Error: node_modules/angular-file/file-upload/ngf.directive.d.ts:73:21 - error TS2694: Namespace '"/Users/za/project/shopizer-admin/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

73     static ɵfac: i0.ɵɵFactoryDeclaration<ngf, never>;
                       ~~~~~~~~~~~~~~~~~~~~
node_modules/angular-file/file-upload/ngf.directive.d.ts:74:21 - error TS2694: Namespace '"/Users/za/project/shopizer-admin/node_modules/@angular/core/core"' has no exported member 'ɵɵDirectiveDeclaration'.

74     static ɵdir: i0.ɵɵDirectiveDeclaration<ngf, "[ngf]", ["ngf"], { "multiple": "multiple"; "accept": "accept"; "maxSize": "maxSize"; "ngfFixOrientation": "ngfFixOrientation"; "fileDropDisabled": "fileDropDisabled"; "selectable": "selectable"; "lastInvalids": "lastInvalids"; "lastBaseUrl": "lastBaseUrl"; "file": "file"; "files": "files"; "capturePaste": "capturePaste"; }, { "directiveInit": "init"; "lastInvalidsChange": "lastInvalidsChange"; "lastBaseUrlChange": "lastBaseUrlChange"; "fileChange": "fileChange"; "filesChange": "filesChange"; "fileSelectStart": "fileSelectStart"; }, never>;
                       ~~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-file/file-upload/ngf.module.d.ts:11:21 - error TS2694: Namespace '"/Users/za/project/shopizer-admin/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

11     static ɵfac: i0.ɵɵFactoryDeclaration<ngfModule, never>;
                       ~~~~~~~~~~~~~~~~~~~~
[0mnode_modules/angular-file/file-upload/ngf.module.d.ts:12:21 - error TS2694: Namespace '"/Users/za/project/shopizer-admin/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.

12     static ɵmod: i0.ɵɵNgModuleDeclaration<ngfModule, [typeof i1.ngfDrop, typeof i2.ngfSelect, typeof i3.ngfBackground, typeof i4.ngfSrc, typeof i5.ngfUploadStatus, typeof i6.ngfFormData, typeof i7.ngf], [typeof i8.CommonModule], [typeof i1.ngfDrop, typeof i2.ngfSelect, typeof i3.ngfBackground, typeof i4.ngfSrc, typeof i5.ngfUploadStatus, typeof i6.ngfFormData, typeof i7.ngf]>;
                       ~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-file/file-upload/ngf.module.d.ts:13:21 - error TS2694: Namespace '"/Users/za/project/shopizer-admin/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.

13     static ɵinj: i0.ɵɵInjectorDeclaration<ngfModule>;
                       ~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-file/file-upload/ngfBackground.directive.d.ts:8:21 - error TS2694: Namespace '"/Users/za/project/shopizer-admin/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

8     static ɵfac: i0.ɵɵFactoryDeclaration<ngfBackground, never>;
                      ~~~~~~~~~~~~~~~~~~~~
node_modules/angular-file/file-upload/ngfBackground.directive.d.ts:9:21 - error TS2694: Namespace '"/Users/za/project/shopizer-admin/node_modules/@angular/core/core"' has no exported member 'ɵɵDirectiveDeclaration'.

9     static ɵdir: i0.ɵɵDirectiveDeclaration<ngfBackground, "[ngfBackground]", never, { "file": "ngfBackground"; }, {}, never>;
                      ~~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-file/file-upload/ngfDrop.directive.d.ts:17:21 - error TS2694: Namespace '"/Users/za/project/shopizer-admin/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

17     static ɵfac: i0.ɵɵFactoryDeclaration<ngfDrop, never>;

Tried changing node version, TS version, cli version with no luck. It seems like a path issue. Also, tried older/newer versions of angular-file, deleting node_modules dir, deleting lock file with no luck.Also, tried building/running the app using docker file, and getting same issue, so it seems it's not local machine/Mac-osx related docker build - < docker/Dockerfile-all. The code of app is on the link.

Edit:

za:shopizer-admin za$ ng version

Angular CLI: 13.3.11
Node: 12.22.10
Package Manager: npm 6.14.16
OS: darwin x64

Angular: 11.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.14
@angular-devkit/build-angular   0.1102.14
@angular-devkit/core            9.1.15
@angular-devkit/schematics      13.3.11
@angular/cdk                    10.2.7
@angular/cli                    13.3.11
@schematics/angular             13.3.11
rxjs                            6.6.7
typescript                      4.0.8
    
za:shopizer-admin za$ 

Edit: ng version updated

    Angular CLI: 13.3.11
Node: 12.22.10
Package Manager: npm 6.14.16
OS: darwin x64

Angular: 13.4.0
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.11
@angular-devkit/build-angular   13.3.11
@angular-devkit/core            13.3.11
@angular-devkit/schematics      13.3.11
@angular/cdk                    13.3.9
@angular/cli                    13.3.11
@angular/language-service       13.3.11
@schematics/angular             13.3.11
rxjs                            6.6.7
typescript                      4.4.2

getting error:

  Error: node_modules/@nebular/theme/components/cdk/table/table.module.d.ts:14:22 - error TS2415: Class 'NbTable<T>' incorrectly extends base class 'CdkTable<T>'.
  Property '_viewRepeater' is optional in type 'NbTable<T>' but required in type 'CdkTable<T>'.

14 export declare class NbTable<T> extends CdkTable<T> {
                        ~~~~~~~


Error: node_modules/@nebular/theme/schematics/util/ast.d.ts:2:34 - error TS2307: Cannot find module '@angular-devkit/core/src/experimental/workspace' or its corresponding type declarations.

2 import { WorkspaceProject } from '@angular-devkit/core/src/experimental/workspace';
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/@nebular/theme/schematics/util/project.d.ts:2:34 - error TS2307: Cannot find module '@angular-devkit/core/src/experimental/workspace' or its corresponding type declarations.

2 import { WorkspaceProject } from '@angular-devkit/core/src/experimental/workspace';
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Solution

  • Your versions are not aligned : you have v9, v11 and v13.

    Make sure the CDK, CLI, the schematics and all other angular packages use the same major version.