ng2-image-viewer is not compatible with latest version of angular (11+)

2k Views Asked by At

I'm getting this error on ng serve:

ERROR in node_modules/ng2-image-viewer/index.d.ts:3:22 - error NG6003: Appears in the NgModule.exports of SharedModule, but could not be resolved to a NgModule, Component, Directive, or Pipe class.

This likely means that the library (ng2-image-viewer) which declares ImageViewerModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also, consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

1

There are 1 best solutions below

0
On BEST ANSWER

the ng2-image-viewer package has not been updated since angular version 7, therefore, it is no more usable with higher versions of angular.

a better alternative can be the ngx-doc-viewer package, with a little bit of difference with ng2-image-viewer.

I hope this answer will give a perfect alternative to those trying to use ng2-image-viewer in their applications.