-1

I have an Angular project and sometime fairly recently (I wish I knew exactly when) a couple errors started showing up in the console about missing modules. The errors are:

Uncaught Error: Cannot find module 'jquery'

Uncaught Error: Cannot find module 'prototype-extender'

It doesn't seem to be affecting anything and everything still runs right but I would like to figure out what they are and how to get rid of them. I am not using jquery and I have not heard of the other so is it something that another dependency brought in? I also tried installing jquery as shown here but it still gives me the same error. I did try Googling around but all I found were variations of the above on how to use jquery in Angular. I really don't want to use it so that's not completely relevant and as mentioned I tried the install methods there and still get the same issue...

Any thoughts on where this came from and how to get rid of it? Or even how to track down the dependency that may be requiring it?

EDIT Per comments below, in case it helps, here is my tsconfig.json file:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "downlevelIteration": true,
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2020",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}
sfaust
  • 2,089
  • 28
  • 54

1 Answers1

1

Try running following commands in command prompt.
Try to install node modules globally by giving -g flag

npm install -g jquery 

npm install -g prototype-extender

If this doesn't work try by deleting node modules folder and running npm install.

If this also doesn't work then you might wanna go into your tsconfig.json and set the "moduleResolution" to "node".

Kartik Dolas
  • 703
  • 1
  • 9
  • 24
  • That's in the link I put on there. I tried that and verified that jquery is in the node_modules folder but it still gives me the same error. – sfaust Apr 06 '21 at 16:23
  • Take a look at edits, and please let me know if it helps. – Kartik Dolas Apr 10 '21 at 05:38
  • Sorry for the delay, got pulled away on something else. I just tried that and got the same result. It says it installed it but when I start it gives me the same error. – sfaust Apr 21 '21 at 05:52
  • 1
    Try the last line of my edited answer. I think it should work now. – Kartik Dolas Apr 29 '21 at 10:21