cannot find name 'require' in angular 7(typescript 3.1.3) cannot find name 'require' in angular 7(typescript 3.1.3) angular angular

cannot find name 'require' in angular 7(typescript 3.1.3)


The problem also remained after adding it to my tsconfig.json, but additionaly adding the following line to tsconfig.app.json resolved it for me:

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

So be sure to add this into both files ./tsconfig.json AND ./src/tsconfig.app.json and it should work.


Add the following settings to src/tsconfig.app.json

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


Type node is missing

install @types/node :

npm install --save @types/node

or

yarn add @types/node

edit your src/tsconfig.json adding:

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