I just updated my project from Angular 7 to 8 (using ng update and following the Angular update guide), and everything was fine. Then I proceeded to Angular 9 and the project suddenly couldn't find the ngx-scroll-event@2.0.2 package anymore. Now it's throwing the "module not found" error:
Cannot find module 'ngx-scroll-event' or its corresponding type declarations.ts(2307)
Thinking that it might really be a dependency error, I used a few commands to avoid some dependency tree problems, like:
npm uninstall ngx-scroll-event
npm install ngx-scroll-event@2.0.2
npm update
npm ci
npm rebuild
npm cache verify
Everything was successful, no error was thrown, the package is listed on package.json/package-lock.json AND its folder is present, built on /node_modules, but when I try to run the project with ng s, the error continues. What am I doing wrong?
I faced a similar issue after migrating my project to Angular 9. After inspecting the "ngx-scroll-event" inside the node_modules folder, I realized that the "ngx-scroll-event" folder contains another dist folder that contains the library files.
So I changed the import syntax from the 'ngx-scroll-event' to 'ngx-scroll-event/dist/ngx-scroll-event' and it worked just fine.
For example:
import {NgxScrollEvent} from 'ngx-scroll-event/dist/ngx-scroll-event';
There will be better solution for this issue, but atleast it works.