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:
- Typescript error: TSError: x Unable to compile TypeScript…
- TypeScript error TS2345: Argument of type ‘String ‘is not assignable to parameter of type ‘string’
- Error: Cannot find module ‘./application‘ [How to Solve]
- Error Cannot find module ‘worker_threads‘ [How to Solve]
- [Solved] gyp ERR! stack Error: Could not find any Python installation to use
- [Solved] Node error: Error: Cannot find module ‘body-parser‘
- [Solved] Error: Cannot find module ‘@vue/cli-shared-utils
- [Solved] Error: Cannot find module ‘@vue/cli-shared-utils‘
- Module build failed: Error: Couldn’t find preset “es2015” relative to directory
- [Solved] VS Code Error: Vetur can‘t find ‘tsconfig.json‘ or ‘jsconfig.json‘
- [Solved] Syntax Error: Error: Cannot find module ‘cache-loader‘
- The vue3 project Error: Cannot find module’vue-loader-v16/package.json’
- [Solved] ERROR Error: Cannot find module ‘vue-loader-v16/package.json‘
- [Solved] Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘
- When starting Vue project: cannot find module ‘webpack cli/bin/config yargs’ error resolution
- Vue project Run Error: Syntax Error: Error: Cannot find module ‘less‘
- How to Solve Nodejs error: cannot find module ‘. /application’
- [Solved] Error: Cannot find module ‘vue-template-compiler/package.json‘ Require stack:
- [Solved] Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.
- Node.js Error: Error: Cannot find module ‘express‘ [How to Solve]