-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@types/node": "14.0.5" - Variable 'global' must be of type 'Global', but here has type 'Global & typeof globalThis'. #45116
Comments
Uh oh, please run |
+-- @angular-devkit/build-angular@0.901.7 |
The main issue is that |
I've found the line that caused the problem: Although I'm not 100% sure, it seems that this line could be omitted. |
Those files aren't even supposed to be compiled according to |
It works if you downgrade to @types/node@13.7 |
Hi @erlendga, if you are using NodeJS 14 have you tried |
@simonua I should probably open an issue in angular/angular, since the problem was caused by me. |
@JasonHK, I appreciate the ownership. Thank you. |
In your |
Hi @JasonHK , can you please provide a link to the issue in Angular so I can subscribe to it? Thank you! |
I replaced the variable name global with 'some variable name' and replaced all its occurrence in this file /zone.js.d.ts. |
I have come across this issue in a React Native project. We're using node 12 and have found the error is removed by downgrading to |
@tafty thanks for sharing, same situation here. The downgrade worked |
@SimonSchick, +-- @angular-devkit/build-angular@0.901.12 npm ERR! peer dep missing: webpack-dev-server@^3.1.4, required by @angular-devkit/build-webpack@0.901.12 |
I replaced const window = domino.createWindow(template);
global['window'] = window;
global['document'] = window.document; with const window = domino.createWindow(template);
(global as any).window = window;
(global as any).document = window.document; and it's working fine with the latest |
@Greenek Using |
I upgraded from Angular 9.17 to 9.19 and now ng build fails with the following error complaining about a variable declaration in both @types/node and zone.js:
ERROR in node_modules/@types/node/ts3.5/globals.global.d.ts:1:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'global' must be of type 'Global', but here has type 'Global & typeof globalThis'.
1 declare var global: NodeJS.Global & typeof globalThis; ~~~~~~
node_modules/zone.js/dist/zone.js.d.ts:600:13 600 declare var global: NodeJS.Global; ~~~~~~ 'global' was also declared here.
When I downgrade @types/node to 14.0.4, everything works. I am using version 0.10.3 of zone.js.
The text was updated successfully, but these errors were encountered: