Cannot find module '@angular/service-worker

ionic serve

ng run app:serve --host=localhost --port=8100
[ng] (node:3323) [DEP0131] DeprecationWarning: The legacy HTTP parser is deprecated.
[ng] chunk {main} main.js, main.js.map (main) 2.18 kB [initial] [rendered]
[ng] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 127 kB [initial] [rendered]
[ng] chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
[ng] chunk {styles} styles.js, styles.js.map (styles) 95.9 kB [initial] [rendered]
[ng] chunk {vendor} vendor.js, vendor.js.map (vendor) 341 kB [initial] [rendered]
[ng] Date: 2022-09-14T11:40:42.270Z - Hash: 631ea6cb964e56859efd - Time: 29662ms
[ng] ERROR in src/app/app.module.ts:21:37 - error TS2307: Cannot find module ‘@angular/service-worker’ or its corresponding type declarations.
[ng] 21 import { ServiceWorkerModule } from ‘@angular/service-worker’;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~~

[INFO] Development server running!

   Local: http://localhost:8100
   
   Use Ctrl+C to quit this process

[INFO] Browser window opened to http://localhost:8100!

For this error, what worked for me:
$ npm install @angular/service-worker --force