Error in Node_Modules/@Types/Node/Globals. Global. D. Ts(1,44): Error Ts2304: Cannot Find Name 'Globalthis'

I am using angular 7.2.6, angular-cli 7.3.9 and typescript 3.2.4. I am getting error when building angular app ERROR in node_modules/@types/node/globals.global.d.ts(1,44): error TS2304: Cannot find name 'globalThis'. Can someone please let me know the probable cause for this error.

I see globalThis is introduced in typescript 3.4; but considering i am using typescript 3.2.4, not sure what is causing the above, and how globalThis module is being referred to access variables.

4 Answers

Thanks Vishal Kedar for your response. Your response helped me to think and explore further. After i changed "@types/node": "10.14.0", the issue is resolved.

Update the package.json file for the below module

"@types/node": "^14.0.4"
1

Yes! as @vishal said:

npm install @types/node@14.0.4 --saveDev

works perfectly for me too

Thanks!

I had so error code when i compiled my project.

ERROR in node_modules/@types/node/globals.global.d.ts(1,44): error TS2304: Cannot find name 'globalThis'.

In my case : I opened this file globals.global.d.ts and it has so line

declare var global: NodeJS.Global & typeof globalThis;

and i commented this line and problem was solved

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest