How to solve error message when importing module in TypeScript saying: "Cannot find module ... Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?"
This can be solved by adding "moduleResolution": "node"
, to your tsconfig.json file. After this is added your compilerOptions in tsconfig.json file should look like this:
"compilerOptions": {
"target": "esnext",
"module": "amd",
"moduleResolution": "node",
"allowJs": true,
"strict": true,
"esModuleInterop": true
},
After this change, if you see another error saying: "Could not find a declaration file for module..." you can try to change strict param to false:
"compilerOptions": {
"target": "esnext",
"module": "amd",
"moduleResolution": "node",
"allowJs": true,
"strict": false,
"esModuleInterop": true
},