SOLVED

Angular build showing BrowserModule has already been loaded on browser

Copper Contributor

Hi,

I have angular build pipeline at Azure DevOps and it is successfully deployed to the Azure App service.

 

The issue I am facing is while on selecting specific option it is not responding. and getting below error:

 

main-es2017.3ab685c8fd4c22c3c48d.js:1 ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.

 

Rest options are working fine.

Even already existing pipelines are working fine as wellangular-issue.PNG

 

Please let me know is there any new update for the angular pipeline or something has to update at Code end.

4 Replies

@Asma_Gh 
I am facing the same problem. I already checked the BrowserModule and it is only imported on app.module. I don't know how to fix it.

best response confirmed by bhaikaju (Microsoft)
Solution

@tbsouza: Please remove the import for the BrowserModule from any other module because it is already imported in the AppModule when you create the Angular application. You should only import the CommonModule in all other modules.

Hope it helps!!  :smile:

Got the same error ('Error: BrowserModule has already been loaded...'), and the fix was similar to what @bhaikaju mentioned, but I had to remove BrowserAnimationsModule from other modules, since it was already imported in AppModule. So basically, remove that extra module import from from any other module which is already imported in the AppModule.

1 best response

Accepted Solutions
best response confirmed by bhaikaju (Microsoft)
Solution

@tbsouza: Please remove the import for the BrowserModule from any other module because it is already imported in the AppModule when you create the Angular application. You should only import the CommonModule in all other modules.

Hope it helps!!  :smile:

View solution in original post