tjoskar / ng-lazyload-image

🖼 A small library for lazy loading images for Angular apps with zero dependencies
https://naughty-bose-ec1cfc.netlify.com
MIT License
763 stars 142 forks source link

Build is failing with below error #538

Open sameer-coditas opened 2 years ago

sameer-coditas commented 2 years ago

Exception error

ERROR in node_modules/ng-lazyload-image/src/lazyload-image.directive.d.ts:27:21 - error TS2694: Namespace '"/Users/sameerkhan/AmbryGen/patientportal-UI/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

27     static ɵfac: i0.ɵɵFactoryDeclaration<LazyLoadImageDirective, never>;
                       ~~~~~~~~~~~~~~~~~~~~
node_modules/ng-lazyload-image/src/lazyload-image.directive.d.ts:28:21 - error TS2694: Namespace '"/Users/sameerkhan/AmbryGen/patientportal-UI/node_modules/@angular/core/core"' has no exported member 'ɵɵDirectiveDeclaration'.

28     static ɵdir: i0.ɵɵDirectiveDeclaration<LazyLoadImageDirective, "[lazyLoad]", never, { "lazyImage": "lazyLoad"; "defaultImage": "defaultImage"; "errorImage": "errorImage"; "scrollTarget": "scrollTarget"; "customObservable": "customObservable"; "offset": "offset"; "useSrcset": "useSrcset"; "decode": "decode"; "debug": "debug"; }, { "onStateChange": "onStateChange"; }, never>;
                       ~~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-lazyload-image/src/lazyload-image.module.d.ts:4:21 - error TS2694: Namespace '"/Users/sameerkhan/AmbryGen/patientportal-UI/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

4     static ɵfac: i0.ɵɵFactoryDeclaration<LazyLoadImageModule, never>;
                      ~~~~~~~~~~~~~~~~~~~~
node_modules/ng-lazyload-image/src/lazyload-image.module.d.ts:5:21 - error TS2694: Namespace '"/Users/sameerkhan/AmbryGen/patientportal-UI/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.

5     static ɵmod: i0.ɵɵNgModuleDeclaration<LazyLoadImageModule, [typeof i1.LazyLoadImageDirective], never, [typeof i1.LazyLoadImageDirective]>;
                      ~~~~~~~~~~~~~~~~~~~~~
node_modules/ng-lazyload-image/src/lazyload-image.module.d.ts:6:21 - error TS2694: Namespace '"/Users/sameerkhan/AmbryGen/patientportal-UI/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.

6     static ɵinj: i0.ɵɵInjectorDeclaration<LazyLoadImageModule>;
                      ~~~~~~~~~~~~~~~~~~~~~

Environment

   _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 9.1.13
Node: 16.13.1
OS: darwin arm64

Angular: 9.1.13
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.15
@angular-devkit/build-angular     0.901.15
@angular-devkit/build-optimizer   0.901.15
@angular-devkit/build-webpack     0.901.15
@angular-devkit/core              9.1.15
@angular-devkit/schematics        9.1.13
@angular/cdk                      9.2.4
@angular/flex-layout              9.0.0-beta.31
@angular/material                 9.2.4
@ngtools/webpack                  9.1.15
@schematics/angular               9.1.13
@schematics/update                0.901.13
rxjs                              6.6.7
typescript                        3.7.7
webpack                           4.42.0

Package json

"@angular/animations": "^9.0.0",
    "@angular/cdk": "^9.0.1",
    "@angular/common": "^9.0.0",
    "@angular/compiler": "^9.0.0",
    "@angular/core": "^9.0.0",
    "@angular/flex-layout": "^9.0.0-beta.29",
    "@angular/forms": "^9.0.0",
    "@angular/material": "^9.0.0",
    "@angular/platform-browser": "^9.0.0",
    "@angular/platform-browser-dynamic": "^9.0.0",
    "@angular/router": "^9.0.0",
    "@material-extended/mde": "^2.1.0",
    "@ngx-translate/core": "^12.1.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@sentry/angular": "^6.10.0",
    "@sentry/tracing": "^6.10.0",
    "@stripe/stripe-js": "~1.18.0",
    "@types/crypto-js": "^3.1.43",
    "@types/file-saver": "^2.0.0",
    "angular-user-idle": "^2.2.6",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.4",
    "crypto-js": "^3.1.9-1",
    "file-saver": "^2.0.0",
    "lodash": "^4.17.21",
    "moment": "^2.22.2",
    "net": "^1.0.2",
    "ng-image-slider": "^2.8.0",
    "ng-recaptcha": "^5.0.0",
    "ng2-pdf-viewer": "^6.1.2",
    "ngx-device-detector": "^2.0.9",
    "ngx-image-cropper": "^3.3.5",
    "ngx-matomo": "^0.1.4",
    "ngx-stripe": "~12.4.0",
    "node-gyp": "^6.1.0",
    "reading-time": "^1.2.0",
    "rxjs": "^6.5.4",
    "rxjs-compat": "^6.5.4",
    "sockjs-client": "^1.3.0",
    "sprintf": "^0.1.5",
    "sprintf-js": "^1.1.2",
    "stompjs": "^2.3.3",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.10.2"

Can you check?

salohcin714 commented 2 years ago

Can confirm this is happening with Angular 11 as well.

tjoskar commented 2 years ago

Hi, What version of ng-lazyload-image are you using? I can't see it in the list. If you are using 9.1.1, can you try to downgrade it to 9.1.0 and see if it works.

Angular below 11 is no longer supported by the Angular team. 11 is however supported.

sameer-coditas commented 2 years ago

@tjoskar I am using the 9.1.1 version only.

sanderschnydrig commented 2 years ago

I am on version 9.1.0 and getting the same errors

sanderschnydrig commented 2 years ago

fixed this by permanently setting the version:

from

"ng-lazyload-image": "^9.1.0"

to

"ng-lazyload-image": "9.1.0"
tjoskar commented 2 years ago

In version 9.1.1 I rebuild the lib to make it work with Angular 13 (no source code change). Apparently something broke with older version of Angular.

Do any one of you use Angular 12 or 13?

sameer-coditas commented 2 years ago

@sanderschnydrig Your solution worked for me. Thank you.

sanderschnydrig commented 2 years ago

@tjoskar I am using Angular 11. Here are some relevant dependencies I'm using: dependencies

"@angular/animations": "~11.2.14",
"@angular/cdk": "~11.2.13",
"@angular/common": "~11.2.14",
"@angular/compiler": "~11.2.14",
"@angular/core": "~11.2.14",
"@angular/fire": "^6.1.5",
"@angular/flex-layout": "^11.0.0-beta.33",
"@angular/forms": "~11.2.14",
"@angular/material": "~11.2.13",
"@angular/platform-browser": "~11.2.14",
"@angular/platform-browser-dynamic": "~11.2.14",
"@angular/router": "~11.2.14",
"@angular/service-worker": "~11.2.14"

devDependencies

"@angular-devkit/architect": ">= 0.900 < 0.1300",
"@angular-devkit/build-angular": "~0.1102.14",
"@angular-eslint/builder": "4.3.0",
"@angular-eslint/eslint-plugin": "4.3.0",
"@angular-eslint/eslint-plugin-template": "4.3.0",
"@angular-eslint/schematics": "4.3.0",
"@angular-eslint/template-parser": "4.3.0",
"@angular/cli": "~11.2.14",
"@angular/compiler-cli": "~11.2.14",
"@angular/language-service": "~11.2.14"

@sameer-coditas Most welcome. The error messages are not very helpful to be honest :)

quimack commented 2 years ago

fixed this by permanently setting the version:

from

"ng-lazyload-image": "^9.1.0"

to

"ng-lazyload-image": "9.1.0"

this work for me! with angular 10

vvasiloud commented 2 years ago

Any plans to fix this issue for Angular 14 or 13?

tjoskar commented 2 years ago

@vvasiloud I have not been able to reproduce this for Angular 12 or above. Do you have a repo where you can reproduce this that you can share?