'Ng serve throwing @angular/core/core has no exported member 'ɵɵFactoryDeclaration'
I'm getting errors stating that angular/core/core has no exported member 'ɵɵFactoryDeclaration' while I ran ng serve
on angular9 project. The error I am getting is
ERROR in node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.service.d.ts:18:21 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
18 static ɵfac: i0.ɵɵFactoryDeclaration<GoogleTagManagerService, [{ optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.service.d.ts:19:22 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectableDeclaration'.
19 static ɵprov: i0.ɵɵInjectableDeclaration<GoogleTagManagerService>;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.module.d.ts:6:21 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
6 static ɵfac: i0.ɵɵFactoryDeclaration<GoogleTagManagerModule, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.module.d.ts:7:21 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
7 static ɵmod: i0.ɵɵNgModuleDeclaration<GoogleTagManagerModule, never, never, never>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.module.d.ts:8:21 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
8 static ɵinj: i0.ɵɵInjectorDeclaration<GoogleTagManagerModule>;
~~~~~~~~~~~~~~~~~~~~~
** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **
60% building 41/41 modules 0 active
ERROR in node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.service.d.ts:18:21 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
18 static ɵfac: i0.ɵɵFactoryDeclaration<GoogleTagManagerService, [{ optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.service.d.ts:19:22 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectableDeclaration'.
19 static ɵprov: i0.ɵɵInjectableDeclaration<GoogleTagManagerService>;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.module.d.ts:6:21 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
6 static ɵfac: i0.ɵɵFactoryDeclaration<GoogleTagManagerModule, never>;
~~~~~~~~~~~~~~~~~~~~
node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.module.d.ts:7:21 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
7 static ɵmod: i0.ɵɵNgModuleDeclaration<GoogleTagManagerModule, never, never, never>;
~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-google-tag-manager/lib/angular-google-tag-manager.module.d.ts:8:21 - error TS2694: Namespace '"/mnt/db39af7f-bc9a-47a8-9fc8-d11b12e7dff2/Digicorp/Jewelegance/application/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
8 static ɵinj: i0.ɵɵInjectorDeclaration<GoogleTagManagerModule>;
~~~~~~~~~~~~~~~~~~~~~
Date: 2022-05-05T08:15:18.659Z - Hash: 3aa67f9dc972eec79277
2 unchanged chunks
chunk {main} main.js, main.js.map (main) 2.41 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 141 kB [initial] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 2.28 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.97 MB [initial] [rendered]
Time: 42770ms
WARNING in ./src/assets/css/main.min.css (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./src/assets/css/main.min.css)
Module Warning (from ./node_modules/postcss-loader/src/index.js):
Warning
(160:28143) start value has mixed support, consider using flex-start instead
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 100:30-36
Can't import the named export 'Inject' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 105:30-36
Can't import the named export 'Inject' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 110:30-36
Can't import the named export 'Inject' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 115:30-36
Can't import the named export 'Inject' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 120:30-36
Can't import the named export 'Inject' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 125:30-36
Can't import the named export 'Inject' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 92:18-28
Can't import the named export 'Injectable' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/ngx-window-token/fesm2015/ngx-window-token.mjs 3:19-33
Can't import the named export 'InjectionToken' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 142:18-26
Can't import the named export 'NgModule' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 98:30-38
Can't import the named export 'Optional' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 103:30-38
Can't import the named export 'Optional' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 108:30-38
Can't import the named export 'Optional' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 113:30-38
Can't import the named export 'Optional' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 118:30-38
Can't import the named export 'Optional' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 123:30-38
Can't import the named export 'Optional' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 89:478-496
Can't import the named export 'ɵɵFactoryTarget' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 138:157-175
Can't import the named export 'ɵɵFactoryTarget' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 91:0-27
Can't import the named export 'ɵɵngDeclareClassMetadata' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 141:0-27
Can't import the named export 'ɵɵngDeclareClassMetadata' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 89:31-52
Can't import the named export 'ɵɵngDeclareFactory' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 138:30-51
Can't import the named export 'ɵɵngDeclareFactory' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 90:32-56
Can't import the named export 'ɵɵngDeclareInjectable' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 140:30-52
Can't import the named export 'ɵɵngDeclareInjector' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/angular-google-tag-manager/fesm2015/angular-google-tag-manager.mjs 139:30-52
Can't import the named export 'ɵɵngDeclareNgModule' from non EcmaScript module (only default export is available)
Here are my depencencies:
"@angular/animations": "^9.0.6",
"@angular/cdk": "^9.1.2",
"@angular/common": "~9.0.5",
"@angular/compiler": "~9.0.5",
"@angular/core": "~9.0.5",
"@angular/forms": "~9.0.5",
"@angular/platform-browser": "~9.0.5",
"@angular/platform-browser-dynamic": "~9.0.5",
"@angular/platform-server": "~9.0.5",
"@angular/router": "~9.0.5",
"@fortawesome/angular-fontawesome": "^0.6.0",
"@fortawesome/fontawesome-common-types": "^0.2.27",
"@fortawesome/fontawesome-svg-core": "^1.2.27",
"@nguniversal/express-engine": "^9.0.2",
"@ngx-share/button": "^7.1.4",
"@ngx-share/buttons": "^7.1.4",
"@ngx-share/core": "^7.1.4",
"angular-google-tag-manager": "^1.3.0",
"chalk": "^3.0.0",
"crypto-js": "^4.0.0",
"express": "^4.15.2",
"font-awesome": "^4.7.0",
"fs": "0.0.1-security",
"jquery": "^3.4.1",
"knex": "^0.20.11",
"lodash": "^4.17.15",
"mysql": "^2.18.1",
"ng-lazyload-image": "^7.1.0",
"ng2-nouislider": "^1.8.2",
"ng5-slider": "^1.2.4",
"ngx-captcha": "^8.0.1",
"ngx-clipboard": "^13.0.0",
"ngx-cookie-service": "^3.0.2",
"ngx-infinite-scroll": "^8.0.1",
"ngx-mask": "^8.1.7",
"ngx-quicklink": "^0.2.0",
"ngx-sharebuttons": "^4.1.4",
"primeicons": "^2.0.0",
"primeng": "^9.0.5",
"request": "^2.88.2",
"request-promise": "^4.2.5",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"underscore": "^1.10.2",
"xmlbuilder": "^15.0.0",
"zone.js": "~0.10.2"
And here are my dev dependencies:
"@angular-devkit/build-angular": "~0.900.5",
"@angular/cli": "~9.0.5",
"@angular/compiler-cli": "~9.0.5",
"@angular/language-service": "~9.0.5",
"@nguniversal/builders": "^9.0.2",
"@types/express": "^4.17.0",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.7.5"
What different approaches I have tried is
removed node_modules and package-lock.json and reinstall the app using
npm i
executed
npm ci
added in tsconfig.json
"compilerOptions": { ... "paths": { "@angular/*": ["../node_modules/@angular/*"] } },
removed angular-google-tag-manager and install it through
npm i angular-google-tag-manager
npm update
Environment
Angular CLI: 9.0.7
Node: 12.22.12
OS: linux x64
npm 6.14.16
tsc 3.8.3
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|