Cannot find name 'console'. What could be the reason for this?
Add "dom" in your lib section in compilerOptions in tsconfig.json.
Example:
{
"compilerOptions": {
"rootDir": "src",
"outDir": "bin",
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"target": "es5",
"lib": [
"es6",
"dom" <------- Add this "dom" here
],
"types": [
"reflect-metadata"
],
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
You will have to install the @types/node
to get the node typings, You can achieve that by executing the below command,
npm install @types/node --save-dev
Hope this helps!