'ClientApp/node_modules/rxjs/index.d.ts not found

I am trying to get my Angular 13 app working. I have basically a blank project, but can't get the dependency versioning right. I have found another question similar to this on Stack Overflow, but the answer was to upgrade my Typescript version, which I have done. I will list my dependencies from my package.json file below. If I use rxjs version 7, it gives me the error:

Error TS6053 File 'C:/Users/myname/Source/Repos/KESSDI/KESSDI/ClientApp/node_modules/rxjs/index.d.ts' not found. The file is in the program because: Root file specified for compilation

The error does not seem to cause any problems. It compiles and seems to run fine, but I do not wish to start this project with an ominous error message. If I use rxjs version 6, it does not give me the error, but another one of my dependencies requires version 7 to run. I am using Visual Studio 2022. Below is the list of dependencies:

"dependencies": {
        "@angular/animations": "13.2.0",
        "@angular/cdk": "13.2.1",
        "@angular/common": "13.2.0",
        "@angular/compiler": "13.2.0",
        "@angular/core": "13.2.0",
        "@angular/flex-layout": "13.0.0-beta.38",
        "@angular/forms": "13.2.0",
        "@angular/material": "13.2.1",
        "@angular/platform-browser": "13.2.0",
        "@angular/platform-browser-dynamic": "13.2.0",
        "@angular/router": "13.1.3",
        "@ngx-xxxx-dialogs": "1.0.3",
        "date-fns": "2.28.0",
        "file-saver": "2.0.5",
        "hammerjs": "2.0.8",
        "ngx-webstorage": "9.0.0",
        "rxjs": "7.5.0",
        "tslib": "2.3.0",
        "zone.js": "0.11.4"
    },
    "devDependencies": {
        "@angular-devkit/build-angular": "13.2.1",
        "@angular/cli": "13.2.1",
        "@angular/compiler-cli": "13.2.0",
        "@types/file-saver": "2.0.5",
        "@types/hammerjs": "2.0.41",
        "@types/jasmine": "3.10.0",
        "@types/node": "12.11.1",
        "jasmine-core": "4.0.0",
        "karma": "6.3.0",
        "karma-chrome-launcher": "3.1.0",
        "karma-coverage": "2.1.0",
        "karma-jasmine": "4.0.0",
        "karma-jasmine-html-reporter": "1.7.0",
        "prettier": "2.5.1",
        "replace-in-file": "6.3.2",
        "typescript": "4.5.5",
        "winattr": "3.0.0"
    }


Solution 1:[1]

Try following

  1. Delete node_modules
  2. Delete package-lock.json file if present
  3. Run npm clean cache --force command in terminal.
  4. Then run npm install.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aakash Garg