Angular CLI: 6.0.1
Node: 8.11.1
OS: darwin x64
Angular: 6.0.1
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.1
@angular-devkit/build-angular 0.6.1
@angular-devkit/build-optimizer 0.6.1
@angular-devkit/core 0.6.1
@angular-devkit/schematics 0.6.1
@ngtools/webpack 6.0.1
@schematics/angular 0.6.1
@schematics/update 0.6.1
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
node version: v8.11.1
npm version: 6.0.0
macOS Sierra
We get this error in the browser: ReferenceError: Can't find variable: global
No error
A workaround fixed the issue:
+1
I have the same issue. The workaround fixes the issue though...
Hello Everyone.
Just facing the issue... I did not really understood the workaround. Where to set the variables please?
I thank you in advance for your help.
Well, the issue is that the library tries to find a variable called global which is expected to contain all existing global variables (which usually window does). But this variable is for some reasons undefined so you need to define it on your own by either adding it in the _index.html_ file by adding a script tag to the head:
<script type="text/javascript">
window.global = window;
</script>
Or you do the same thing in _polyfills.ts_ with some decorations to make the Typescript compiler happy:
(windows as any).global = window;
Thanks. I just modified my index.html.
Works fine.
I have the same issue caused by intl polyfill. Workaround 2 worked fine.
In Angular CLI 6 we did remove the node global and others. You can read more about this in https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Well, the issue is that the library tries to find a variable called
globalwhich is expected to contain all existing global variables (which usuallywindowdoes). But this variable is for some reasons undefined so you need to define it on your own by either adding it in the _index.html_ file by adding a script tag to the head:Or you do the same thing in _polyfills.ts_ with some decorations to make the Typescript compiler happy:
(windows as any).global = window;