The icon "icon" does not exist or is not registered | Angular universal

See original GitHub issue

Example code

// icons.module.ts
@NgModule({
  imports: [
    CommonModule,
    NzIconModule.forRoot([
      HomeOutline,
      MacCommandOutline,
      AppstoreAddOutline,
      MenuOutline,
      AppstoreOutline,
      UserOutline,
      PullRequestOutline,
      RollbackOutline,
      DownOutline,
    ]),
  ],
  exports: [NzIconModule],
})
export class IconsModule {}

// app.module.ts
@NgModule({
  declarations: [AppComponent],
  imports: [
    // ... more imports
    IconsModule,
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}

Steps to reproduce

Upgrade from version 13.0.0 to version 13.1.1 with ng update ng-zorro-antd.

What is expected?

A correct universal angular application compilation and usage.

What is actually happening?

Error that X icon has not been registered, it is strange because without changing absolutely nothing of code using version 13.0.0.0 I don’t get any error, but when I update to the latest version I get this error.

I am using the latest version of angular (13.3.2).

Error: [@ant-design/icons-angular]:the icon menu-o does not exist or is not registered.
    at IconNotFoundError (..\dist\naeko-dashboard\server\main.js:1:3066144)
    at ..\dist\naeko-dashboard\server\main.js:1:3069234
    at ..\dist\naeko-dashboard\server\main.js:1:1436878
    at OperatorSubscriber2._this._next (..\dist\naeko-dashboard\server\main.js:1:1395143)
    at OperatorSubscriber2.Subscriber2.next (..\dist\naeko-dashboard\server\main.js:1:1347277)
    at ..\dist\naeko-dashboard\server\main.js:1:1341997
    at Object.errorContext (..\dist\naeko-dashboard\server\main.js:1:1540750)
    at Subject3.next (..\dist\naeko-dashboard\server\main.js:1:1341774)
    at Object.next (..\dist\naeko-dashboard\server\main.js:1:1467113)
    at Object.next (..\dist\naeko-dashboard\server\main.js:1:1349251)

Node.js v17.5.0
error Command failed with exit code 1.
Environment Info
ng-zorro-antd 13.1.1
Browser Microsoft Edge Versión 100.0.1185.29

I have a module called IconsModule where I register the icons that I am using, it is imported to AppModule, and as I said, without changing absolutely nothing of code, I get these errors that the icon has not been found or registered.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
dertuerkecommented, Apr 28, 2022

Do this in you angular.json https://ng.ant.design/components/icon/en#svg-icons

{
  "assets": [
    {
      "glob": "**/*",
      "input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
      "output": "/assets/"
    }
  ]
}
1reaction
KaiSoellchcommented, Apr 23, 2022

Same Problem here 😢

Read more comments on GitHub >

github_iconTop Results From Across the Web

[@ant-design/icons-angular]: the icon arrow-left-o does not ...
What is actually happening? ERROR Error: [@ant-design/icons-angular]: the icon arrow-left-o does not exist or is not registered.
Read more >
Can't render some NG-ZORRO icon - Stack Overflow
According to NG-ZORRO Static loading and dynamic loading, you should follow these steps to display those missing icons. Pre-requisite:.
Read more >
@ant-design/icons-angular - npm
@ant-design/icons-angular. TypeScript icon, indicating that this package has built-in type declarations. 15.0.0 • Public • Published a month ...
Read more >
Angular Service Worker - Step-By-Step Guide
Learn all about the multiple PWA caching configuration options of the ngws-config.json file, build Progressive Web Apps using the Angular ...
Read more >
How To Use Font Awesome icons in Angular Applications
Using font awesome icon library we will register icons only once in the AppModule's constructor using FaIconLibrary.addIcons() or FaIconLibrary.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found