Answers for "error TS2307: Cannot find module 'path' or its corresponding type declarations."

2

error TS2307: Cannot find module 'path' or its corresponding type declarations.

go to 'tsconfig.app.json' and add "node" to types:


/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": ["node"]   <------------ ADD "node" HERE
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}
Posted by: Guest on October-09-2020
1

cannot find module 'path' or its corresponding type declarations

npm i @types/node -D
Posted by: Guest on June-27-2021

Code answers related to "error TS2307: Cannot find module 'path' or its corresponding type declarations."

Code answers related to "TypeScript"

Browse Popular Code Answers by Language