getting "Cannot find module 'rxjs-compat/Observable'" but only code requiring it is RXjs itself

Viewed 1002

error I am getting in console when running an 'ng serve':

module.js:550
    throw err;
    ^

Error: Cannot find module 'rxjs-compat/Observable'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\[USR]\source\repos\[ProprietaryApp]\web\node_modules\rxjs\Observable.js:6:10)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

Problem: All of my code is updated and using the new reference locations. Here is an example:

import { Subject } from 'rxjs';

I did a search in VSCode of all places that use 'rxjs-compat/Observable' and I found that every single one of them is in node_modules\rxjs or a subfolder of node_modules\rxjs.

RXjsLocations

does RXjs V6 require the compat file? I dont want to use it. The compat file is supposed to be a temporary fix.

1 Answers

Seems you are using older version (5 or lower) of RxJs. Try installing Rxjs Compat in order to have all imports fixed implicitly:

npm install --save rxjs-compat

Otherwise, you need to change all imports explicitly.

Related