-1

I've tried installing rxjs with "npm install rxjs" but it still can't find the module after installing. I've tried installing "npm install --save rxjs-compat" as well as reinstalling and uninstalling the modules, but it still doesn't work. Thanks a lot for the help in advance!

enter image description here

Here's the version I'm using from the package.json file: ""rxjs": "^7.4.0","

UPDATE

Tried all the answers but still no luck:

Here's the code for my tsconfig file (Don't know why I can't edit the original question anymore): pastebin.com/bsv51Dmz –

UPDATE 2 I tried installing the version 6.5 and the errors dissapear in visual studio, but I still get them on the console when doing ng serve. Same error, can not find the module. I also tried removing node-modules and doing npm i, but no luck neither, same error happening

UPDATE 3 SOLUTION So what I did was basically I went to stackblitz to find some project that had the same dependencies I was trying to use and was working, and found out they had the dependency declared as "rxjs: latest" I put that declaration on my package.json and then it started working!

  • Here's the code for my tsconfig file (Don't know why I can't edit the original question anymore): https://pastebin.com/bsv51Dmz – Layer891203 Dec 16 '21 at 19:57

5 Answers5

1

Reference: https://rxjs.dev/guide/observable

import { Observable } from 'rxjs';
Faisal Mehboob
  • 609
  • 7
  • 17
1

Have you tried it this way

import * as Rx from 'rxjs';

Or it might be something with your compilerOptions in your tsconfig file.

I'm looking at similar issues here and here

Peter Csala
  • 17,736
  • 16
  • 35
  • 75
  • Tried it and no luck. Tried all the answers in both links and still no luck, I'll upload the compiler options on the question. Thanks a lot for the help! – Layer891203 Dec 16 '21 at 19:53
  • Can you upload it somewhere, maybe github/stackblitz? Could it be somehow related with version incompatibility? – Hristiyan Yanev Dec 16 '21 at 20:05
  • Yes will add as comment on the original question, but it's here: https://github.com/seal63/ImageReelManager/tree/master – Layer891203 Dec 16 '21 at 20:39
0

Maybe you don't have some types needed.

To install all Module Types (CJS/ES6/AMD/TypeScript) via npm:

  • To install this library via npm version 3, use the following command:
     
npm install @reactivex/rxjs
     
  • If you are using npm version 2 before this library has achieved a stable version, you need to specify the library version explicitly:
     
npm install @reactivex/rxjs@5.0.0-beta.1

From official documentation HERE

0

Have you tired a clean install? Remove node_modules and then run npm i Also you could try and either restart your extensions host in vs code or restart vc code completely..

Mackelito
  • 4,213
  • 5
  • 39
  • 78
  • Tried and nothing happened, still the same error. I tried restarting visual studio and still the same. The error happens when doing ng serve as well in the console so it shouldn't be editor related I think – Layer891203 Dec 17 '21 at 14:04
0

Found the answer!

So what I did was basically I went to stackblitz to find some project that had the same dependencies I was trying to use and was working, and found out they had the dependency declared as "rxjs: latest" I put that declaration on my package.json and then it started working!