Has anyone come across error NG0908 and managed to resolve it?
Asked Answered
W

3

6

I can't find much about this error code, it isn't in the docs.

All I can find is this GitHub issue https://github.com/angular/angular/issues/50742

Seems to be to do with angular not detecting zone.js has loaded.

That issue suggests that you ensure poly fills and runtime gets loaded before main.

I've done that, still getting the error every now and then.

Other problem is there's no easy way to reproduce it as 99% of the time it doesn't happen.

So has anyone else had this error code and if so how did you resolve it?

Wheelhouse answered 9/11, 2023 at 15:46 Comment(2)
How do you import zone.js in your app ?Judicator
you need to be a little more specific in regards to the version of angular and other libraries listed in your package.json file for people to be able to help you.Gillenwater
W
9

For Angular version 17, add the below code in the main.server.ts file and it will solve the issue.

import 'zone.js';
Welcome answered 4/1 at 12:58 Comment(0)
T
5

For newer versions of Angular, you need to use this import instead:

import 'zone.js';
Theroid answered 29/12, 2023 at 19:20 Comment(1)
Thank you. This worked for me. Specifically I made this change in src/polyfills.ts, as mentioned in another answer.Verbal
R
1

Please check if zone js is properly imported in polyfills.ts.

import 'zone.js/dist/zone'; // Included with Angular CLI.

Also check if polyfills.ts is getting loaded in angular.json

"polyfills": "src/polyfills.ts",
Raine answered 28/12, 2023 at 15:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.