[Solved] typescript Error: Cannot find name ‘__dirname‘

typescript Error: Cannot find name ‘__dirname‘

 

Solution:

Add “node” to the tsconfig.json file compilerOptions.types

{
 "compilerOptions": {
  ...
  "types": [
    "node"
  ]
  ...
  }
}

Install @types/node

npm install @types/node --save-dev

Read More: